Below, there is my cheat sheet on the useful commands in Linux. If you have forgotten the command you need, you can always look it up here. The most frequently used commands are marked in bold type.
Finding out the size of a file
To find out the certain file size, type in the following command:
du -h /file_path/file name
du -h. /file name – if the file is located in that very folder where you are now
The parameter –h should be added in order to get an understandable representation of the file size.
To display the list of all files with their size, type in:
ll -h – to display the current folder list
ll -h /path to the folder with files
Finding out folder size in Linux
To find out the size of a folder, use the command:
du -sh - the current folder size
du -sh /folder_path
h – display the size in understandable representation, s – display the final size only (without the list of all sub-catalogues and files)
If you need to display the list of all sub-folders of the current folder with their size stated – use ll command; the same is used for files.
Finding out disk size, used and empty disk space
To display the list of all mapped disks and file systems, where the total size, as well as empty and used space will be stated, type in the command:
The result will look something like this:
The lines starting with /dev/ are physical disks; further you can see file systems, located on these disks. Parameter “-a” is necessary for displaying the information about all the disks, installed in the system.
If you have any questions left or need some details – please, ask a question or leave a comment.