VPS skills

Commands to find disk usage of Files and Directories

du (abbreviated from disk usage) is a linux command used to find the file and directory or folder space usage.

Step 1 – To check the disk usage detail of wordpress/wp-admin directory and its sub folders. Enter the command as :

 #du wordpress/wp-admin

Step 2 – Now to check the details in “human Readable format”. that is you can see the details in KB, MB, GB format.

#du -h wordpress/wp-admin

Step 3 –  Insert the -S into the du command, it shows the total disk space occupied by a directory.

#du -sh wordpress/wp-admin 

Step-4–  To show the disk usage based on modification of time, enter the following command as :

#du --time wordpress/wp-admin


Step5– To know the amount of free disk space available in the server, enter the below command as :

#df -h 

Commands to find memory usage using linux commands

Step1– Use the following command to see total amount of free and used physical and swap memory in the server.

also use -m command to know the usage details in MB.

#free  or  #free -m


Step2– Use the following commands to get processor and memory has been used and other information like running processes too.

#top 

Step3–  Also you can get the same information by using below command.

 #cat /proc/meminfo

Step4 – vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

#vmstat


Step5 – To see who is currently logged in and what they are doing on server, enter the below command as :

#w