Linux Basic Commands

Server resources

1. Type the following command at the shell prompt to find out top 10 largest file/directories:

# du -a /var | sort -n -r | head -n 10

3564532 /var
3341588 /var/lib
3312844 /var/lib/mongo
3148820 /var/lib/mongo/journal
1049604 /var/lib/mongo/journal/prealloc.2
1049604 /var/lib/mongo/journal/prealloc.1
1049604 /var/lib/mongo/journal/j._0
177028  /var/log
107304  /var/log/btmp
65604   /var/lib/mongo/local.0

 

2. See the partitions and disk usage:

# df -l

Filesystem     1K-blocks     Used Available Use% Mounted on
rootfs          20186312 18864216    298152  99% /
/dev/root       20186312 18864216    298152  99% /
devtmpfs         4031356      420   4030936   1% /dev
/dev/md2       940626600    73760 892748736   1% /home
tmpfs            4031880        0   4031880   0% /dev/shm

 

# df -h

Filesystem      Size  Used Avail Use% Mounted on
rootfs           20G   18G  292M  99% /
/dev/root        20G   18G  292M  99% /
devtmpfs        3.9G  420K  3.9G   1% /dev
/dev/md2        898G   73M  852G   1% /home
tmpfs           3.9G     0  3.9G   0% /dev/shm