![]() ![]() Likewise, on AlmaLinux and CentOS, you can use the command with yum: sudo yum autoremoveĪnd the same applies to Fedora’s DNF package manager: sudo dnf autoremove With Debian and Ubuntu distributions, you can use APT’s version of the command: sudo apt autoremove These packages are typically ones that were originally installed as dependencies for other packages. This command automatically removes packages that are no longer in use. Most major package managers include an autoremove command. Each package manager offers options to quickly and easily clear out space from unused or unnecessary packages and related data. The best place to start is usually with your Linux package manager. It is likely that at some point you may need to free up disk space on your Linux system. Another reason may be that you received a warning that your system’s disk space is critically low. You may need to clean your disk space on Linux because you need space to install additional software. sudo du -sh /etcĥ.2M /etc How Do I Clean Disk Space on Linux? In the example below, the -h option is used in combination with the -s option. This causes the disk space to be displayed in kilobytes (K), megabytes (M), and gigabytes (G). sudo du -s /Īs with the df command, you can make the output easier to read with the -h option. This is a useful option for directories with many files and subdirectories. ![]() You can isolate disk space information for the target directory by using the -s option. The last entry in the list is always the target directory itself, giving you a summary of the directory’s disk usage. The du command lists all of the files and directories in the target directory and displays their disk usage in kilobytes. sudo du /etc/systemdĤ /etc/systemd/system/Ĥ /etc/systemd/system/Ĥ /etc/systemd/system/Ĥ /etc/systemd/system/ This command summarizes the space usage for a specified directory or the current directory if none is specified. Use the du command to analyze disk space at a more granular level. How to Check Linux Disk Space with the du Command The above command is equivalent to sudo df -h /. You can also use the df command to target a specific drive, using either its “Filesystem” or “Mounted on” description from the columns above. sudo df -hįilesystem Size Used Avail Use% Mounted on This option displays disk space in kilobytes (K), megabytes (M), and gigabytes (G). To make the output from df easier to read, you can add the -h option. Each “block” in the above output represents one kilobyte. The df command (short for “disk free”) shows each drive’s disk size, space used, and free space. sudo dfįilesystem 1K-blocks Used Available Use% Mounted on Use the df command to view your system’s available disk space for each drive. How to Check Linux Disk Space with the df Command These commands provide a high-level view of your whole system’s available disk space and the disk usage within particular directories. Linux systems have two commands readily available for checking your disk space. This guide shows you how to use those commands to get a closer look at your disk usage and start freeing up space. Linux provides several built-in commands for analyzing and cleaning up your system’s disk space.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |