2
2

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.

swap領域を使っているプロセスを表示する。

Last updated at Posted at 2019-03-01

swap領域を使っているプロセス5件を調べるワンライナーを作ってみました。かなり強引ですが。。。

# echo "==== swap ====" ; grep VmSwap /proc/*/status | sort -k 2 -t ":" -r | head -5 ; echo "==== ps ====" ; grep VmSwap /proc/*/status | sort -k 2 -t ":" -r | head -5 | awk -F'[/]' '{print $3}' | xargs ps -p

実行例を載せておきます。

# echo "==== swap ====" ; grep VmSwap /proc/*/status | sort -k 2 -t ":" -r | head -5 ; echo "==== ps ====" ; grep VmSwap /proc/*/status | sort -k 2 -t ":" -r | head -5 | awk -F'[/]' '{print $3}' | xargs ps -p
==== swap ====
/proc/42790/status:VmSwap:        193052 kB
/proc/107858/status:VmSwap:        25364 kB
/proc/774/status:VmSwap:           12484 kB
/proc/108833/status:VmSwap:        10604 kB
/proc/109552/status:VmSwap:         6364 kB
==== ps ====
   PID TTY      STAT   TIME COMMAND
   774 ?        S      0:00 /sbin/dhclient -d -q -sf /usr/libexec/nm-dhcp-helper -pf /var/run/dhclient-ens160.pid -lf /var/lib/NetworkManager/dhclient-b79ef9d4-5822-4
 42790 ?        Sl   115:54 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
107858 ?        Ssl    0:14 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
108833 ?        Ssl   12:22 /usr/bin/python2 -Es /usr/sbin/tuned -l -P
109552 ?        Ss     4:57 /usr/sbin/httpd -DFOREGROUND
2
2
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
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?