Objective
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
Requirements
Privileged access to your Ubuntu System as root or via sudo
command is required.
Conventions
- # – 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
Other Versions of this Tutorial
Instructions
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
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/