The objective is to provide the reader with information on how to check disk space on Ubuntu 18.04 Bionic Beaver Linux.
Operating System and Software Versions
Operating System: - Ubuntu 18.04 Bionic Beaver Linux
Privileged access to your Ubuntu System as root or via sudo command is required.
# - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user
Check disk space from Graphical User Interface
The first tool we are going to discuss is Disk Usage Analyzer. Disk Usage Analyzer should already be installed on your system. In case you need to install it open up terminal and enter:
$ sudo apt install baobab
Once installed, you can launch Disk Usage Analyzer by searching your Activities menu.
After Disk Usage Analyzer starts choose whether you wish to check the disk space of your home directory or the entire file system.
Disk space usage and visualizations of the entire root ("/") directory.
Another, but rather more simplistic disk usage checker tool is called Disks. Start Disks from your activities menu.
After selecting the Hard Drive disk, the Disks utility reveals the information about the disk size and the amount of free disk space.
Check disk space from Command Line
The following list of commands will provide you with an information on how to check disk space on Ubuntu 18.04. First, we will use the du command to check for disk space usage of a single directory like for example our home directory /home/linuxconfig:
$ du -sh /home/linuxconfig
In case we are interested in the size of each directory within /home/linuxconfig we can execute:
$ du -h --max-depth=1 /home/linuxconfig
The same principle applies to checking the disk space usage of the entire root ("/") system directory. However, in this case we need to execute the command with administrative privileges using the sudo command and optionally redirect any error message to /dev/null so we do not pollute our output with unnecessary messages:
$ sudo du -sh / 2> /dev/null
Lastly, we will use the df command to check for any available free disk space in the system's /home directory:
$ df -h /home/
Using du and df commands to check disk space usage and available free space on Ubuntu 18.04 Bionic Beaver Linux
ARE YOU LOOKING FOR A LINUX JOB? Submit your RESUME or create a JOB ALERT on LinuxCareers.com job portal.
DO YOU NEED ADDITIONAL HELP? Get extra help by visiting our LINUX FORUM or simply use comments below.