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.

今日学んだことを投稿する(echo -n)

Posted at

メモリ使用量の調査を行ってたのですが
vmstatでfree領域だけ見ているとどんどん減っている。。。

DISKキャッシュも含まれているので右肩下がりでfree領域が減っていく。
今日は何もアプリケーションを動かしていない、おかしい。
ということで調べたらやっぱりそのとおりでした。

で、代わりに何を使うかなのですが
freeコマンドで対処します。

free
              total        used        free      shared  buff/cache   available
Mem:        8053472     1349456     3173156       70792     3530860     6289800
Swap:             0           0           0

実に扱いにくいです。
加工します。

free | grep -v total |cut -d : -f 2 
        8053472     1366300     3155696       70432     3531476     6273288
             0           0           0

複数行にまたがったデータを1行にまとめます。

free | grep -v total |cut -d : -f 2 | xargs echo -n

8053472 1369856 3151772 70204 3531844 6269824 0 0 0

うまいところ1行で出力ができました!! なかなか強烈 echo -n と xargsの組み合わせ!

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?