![]() ![]() This command is pretty useful when you need to find out which file or directory uses the most disk space under one specific directory.įor example, if we need to get the largest files under /etc directory, we can run the following commands.įind the Largest Files with ls command in Linux head -1: display the first largest files.sort -rh: Reverse the result based on human-readable numbers. ![]() du -sh: display file and directory size in human-readable format.We use the following commands in our examples. ![]() It will list the largest files and directories under the current directory. Then use the head command to print the first few lines of the output. We can pipe the output of the du command to the sort command to sort the files by size. The du command is used to estimate the space used by a file or directory.
0 Comments
Leave a Reply. |