Pages

Check the size of the directory and file (and see the largest in terms of memory)

The command du can be used to check the space (disk usage)
To see the disk space
du -sh * 

To see the disk space and sort it
du -sh * | sort -nr 

To see the disk space and see the top 10 files 
du -sh * | sort -nr | head -n10

To see the disk space and see the top 10 files 
du -sh * | sort -nr | tail -n10

Explanation:

du -s *: Summarizes disk usage of all files
sort -nr: To sort numerically, in reverse order
head -n10: Display first 10 results
tail -n10: Displays last 10 results
h : For human-readable output

To list the top 10 largest files from the current directory, use the following command:
du . | sort -nr | head -n10
du -h . | sort -nr | head -n10 (human readable output)
du, sort -nr and head -n10 serves the same purpose.


To check the diskspace with the control of number of recursive directories.

du -h --max-depth=0 | sort -hr   (only current directory)

du -h --max-depth=1 | sort -hr   (Current directory and one directory depth)


Check free memory in the cluster/supercomputer/linux system


Try:
free -g    (to display the free disk size in GB)

You will get like this.

              total        used        free      shared  buff/cache   available
Mem:              7           6           0           0           1           0

Swap:             7           2           5

Options:
 -b, --bytes       show output in bytes
 -k, --kilo          show output in kilobytes
 -m, --mega      show output in megabytes
 -g, --giga          show output in gigabytes
       --tera          show output in terabytes
 -h, --human    show human-readable output
       --si              use powers of 1000 not 1024
 -l, --lohi           show detailed low and high memory statistics
 -t, --total         show total for RAM + swap
 -s N, --seconds N   repeat printing every N seconds
 -c N, --count N     repeat printing N times, then exit
 -w, --wide          wide output

 --help     display this help and exit
 -V or --version  output version information and exit

This is a series of post on "High Performance Computing (HPC): Everything you need to know before working in a Linux Cluster Environment. To see more post on this series, click here: Important Things to Know to Work in Linux Cluster

No comments:

Post a Comment

You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...