How do I sort disk usage in Linux?
Table of Contents
How do I sort disk usage in Linux?
Let us break down the command and see what says each parameter.
- du command: Estimate file space usage.
- a : Displays all files and folders.
- sort command : Sort lines of text files.
- -n : Compare according to string numerical value.
- -r : Reverse the result of comparisons.
- head : Output the first part of files.
How do you sort du in Unix?
The following command sorts du output by size in descending order. The -n flag is a shorthand of –numeric-sort , which tells sort to sort lines in numerical order. The -r flag means -reverse , which reverse the default ascending order of sort . By default, du scans all subdirectories and includes them in the output.
How do I sort du output?
One of the easiest ways to sort with out the -h option of sort is to first use the du command with out the -h option, sort that output and then run du again on the sorted list of folders.
How do I list the top 10 large files in Linux?
Linux find largest file in directory recursively using find
- Open the terminal application.
- Login as root user using the sudo -i command.
- Type du -a /dir/ | sort -n -r | head -n 20.
- du will estimate file space usage.
- sort will sort out the output of du command.
- head will only show top 20 largest file in /dir/
What is the difference between DF and du in Linux?
df vs. du. The (very complicated) answer can be best summarized like this: The df command provides a sweeping ballpark figure for how much space is being utilized on your filesystem as a whole. The du command is a much more accurate snapshot of a given directory or subdirectory.
How do I free up space in Unix?
How to free disk space on Linux systems
- Checking free space. More about open source.
- df. This is the most basic command of all; df can display free disk space.
- df -h. [[email protected] ~]# df -h.
- df -Th.
- du -sh *
- du -a /var | sort -nr | head -n 10.
- du -xh / |grep ‘^\S*[0-9\.
- find / -printf ‘%s %p\n’| sort -nr | head -10.
How do I get more RAM on Linux?
Linux
- Open the command line.
- Type the following command: grep MemTotal /proc/meminfo.
- You should see something similar to the following as output: MemTotal: 4194304 kB.
- This is your total available memory.
How do I find the top 10 large files in UNIX?
How do I find the top 5 files in UNIX?
How to find out top Directories and files in Linux
- du command -h option : display sizes in human readable format (e.g., 1K, 234M, 2G).
- du command -s option : show only a total for each argument (summary).
- du command -x option : skip directories on different file systems.