HOW TO GET STORAGE SPACE ON THE LINUX TERMINAL

How to Get Storage Space on the Linux Terminal

How to Get Storage Space on the Linux Terminal

Blog Article



How to Get Storage Space on the Linux Terminal

As a Linux user, it's essential to keep track of your system's storage space to ensure you have enough room for your files, programs, and operating system. One way to check the available storage space on your Linux system is by using the terminal. In this article, we will guide you on how to get the storage space on the Linux terminal.

Using the df Command

The df command is a widely used command in Linux to check the available disk space. It stands for "disk free" and provides a detailed report of the disk usage. To use the df command, follow these steps:

  1. Open the terminal on your Linux system.

  2. Type the command df and press Enter.

  3. The terminal will display a list of all the mounted filesystems, including their total size, used space, available space, and percentage of used space.


The output of the df command will look something like this:
Filesystem      1K-blocks       Used  Available Use% Mounted on
udev 1953128 0 1953128 0% /dev
tmpfs 392828 1688 391140 1% /run
/dev/sda1 48383116 14451516 31365100 32% /
tmpfs 1964144 0 1964144 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1964144 0 1964144 0% /sys/fs/cgroup
/dev/sda5 14282528 4286696 9005824 32% /home

Using the df -h Command

The df command displays the disk usage in bytes, which can be difficult to read. To make it easier to understand, you can use the -h option, which stands for "human-readable." This option displays the disk usage in a more readable format, such as gigabytes (GB) or megabytes (MB).

To use the df -h command, follow these steps:

  1. Open the terminal on your Linux system.

  2. Type the command df -h and press Enter.

  3. The terminal will display a list of all the mounted filesystems, including their total size, used space, available space, and percentage of used space, in a human-readable format.


The output of the df -h command will look something like this:
Filesystem      Size  Used Avail Use% Mounted on
udev 1.9G 0 1.9G 0% /dev
tmpfs 383M 1.7M 382M 1% /run
/dev/sda1 46G 14G 30G 32% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda5 14G 4.2G 8.8G 32% /home

Using the du Command

The du command is used to estimate the disk usage of a file or directory. To use the du command, follow these steps:

  1. Open the terminal on your Linux system.

  2. Type the command du -h followed by the path of the file or directory you want to check.

  3. Press Enter to execute the command.


For example, to check the disk usage of the /home directory, you can use the following command:
du -h /home

This will display the total disk usage of the /home directory and all its subdirectories.

Conclusion

In conclusion, checking the storage space on your Linux system is a straightforward process that can be done using the terminal. The df command provides a detailed report of the disk usage, while the du command estimates the disk usage of a file or directory. By using these commands, you can easily keep track of your system's storage space and ensure you have enough room for your files and programs.

For more information on Linux commands and how to use them, you can visit the Linux Commands website, which provides a comprehensive guide to Linux commands and their usage.

By following these steps and using the commands mentioned above, you can easily get the storage space on your Linux terminal and keep your system running smoothly.

Report this page