0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CPUのスレッド数とメモリ容量の取得

Last updated at Posted at 2020-01-27

 仕事柄、Samtoolsなど、実行時のパラメーターとしてスレッド数を記載したりするシェルスクリプトを作成する場合があるので、備忘録として、ターミナル上でのこれら情報の取得の仕方を書いておく。

取得

## CPUスレッド
threads=${thread:=`egrep -c "^processor\s:\s[0-9]+$" /proc/cpuinfo`}
## メモリ容量
memtotal=`grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal: *//' -e 's/ kB//'`
memory_GB=$((memtotal/1024/1024/2))"g"

※上記の「`」は、表記の都合上全角になっているので半角に書き直す

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?