Bash Index : V - The 'V' Bash commands : description, flags and examples

vipw

Usage :

vipw is designed to allow safe edition of the /etc/passwd and /etc/shadow files by putting a lock on the edited file to prevent file corruption due to concurrent modifications (like root editing while bob is changing his password). vipw starts vi to edit the files.

Flags :

Flag Usage
-s Edit the shadow file

Example :

edit /etc/password :

vipw

edit /etc/shadow :

vipw -s

vmstat

Usage :

Report virtual memory statistics : vmstat [options] delay|count

Flags :

Output fields :

  • Swap :
    • si : Amount of memory swapped in from disk per second
    • so : Amount of memory swapped out to disk per second

Example :

Am I swapping ?

vmstat -n 1
If si and so fields are always 0, then the system is currently not swapping. If free still shows swap usage, it must be because some application has used the swap but somehow it's not been cleaned yet. In such situation, a swapoff + swapon command would be handy (albeit not really urgent nor useful since this will be handled automatically anyway).