Managing Disk Space   «Prev  Next»

Managing disk space

This module describes how to manage disk space. First you will learn about the du command, which has several options for displaying the size of files and directories. This module also explains how to save disk space by using file compression. You will learn the compress, uncompress, and zcat commands. Finally, you will learn to work with archives in various ways by using the tar command.
By the end of this module, you will be able to:
  1. Use du to display your disk usage
  2. Use compress and uncompress to manage file sizes
  3. Use zcat to view compressed files
  4. Describe an archive
  5. Use tar cvf to create an archive
  6. Use tar tf to list the file names in an archive
  7. Use tar xvf to extract files from an archive

What is the best way to manage space on a Unix System

There are several ways to manage space on a Unix system. One common method is to use the command line tool "df" to check the available disk space on all file systems, and "du" to check the space used by a specific directory or file. The df command stands for "disk-free," and shows available and used disk space on the Linux system.
df -T
shows the disk usage along with each block's filesystem type (e.g., xfs, ext2, ext3, btrfs, etc.) You can get this information in a graphical view using the Disks (gnome-disk-utility) in the GNOME desktop.
Another useful command is "find" which allows you to search for large files or directories that may be taking up unnecessary space. Additionally, you can use a tool such as "ncdu" which provides a more user-friendly, ncurses-based interface for exploring disk usage. Regularly cleaning up unnecessary files, removing old backups, and using a log rotation tool to limit the size of log files can also help to keep disk usage in check.

In the next lesson, you will learn to display your disk usage with the du command.