In this tutorial, How do I check disk space on Linux distribution? Sometimes you find out which directory consumes how much disk space. I used the du command and the df command. Linux the essential for DevOps Roles.
To check the disk space on a Linux system, you can use the df
command. Here’s how you can do it:
- Investigate the folder for Disk Usage
- Checking Disk Space
Linux check disk space
Investigate the folder for Disk Usage
du command summarizes disk usage and recursively for files and directories
The syntax,
du [option]
For example, Summarizing disk usage in the current directory
[huupv@huupv devopsroles]$ du -sh *
The summarizing includes hidden files
[huupv@huupv devopsroles]$ du -sh .[!.]* *
you can add total the output by adding the -c option
[huupv@huupv devopsroles]$ du -csh .[!.]* *
The screen output terminal:
Investigate root director will only show folders with more than 20GB for disk usage
[huupv@huupv devopsroles]$ sudo du --threshold=20G -ch /.[!.]* /*
Checking Disk Space
[huupv@huupv devopsroles]$ df -h
Conclusion
Thought the article, you can use Linux check disk space as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!