If you want to find the largest files in a directory, you can use the following command in the terminal:

To find the largest files in the directory


du -ah <directory> | sort -rh | head -n 10

Here's what each part of the command does:

- `du -ah <directory>`: This command lists the sizes of all files and directories in the specified directory. The `-a` flag includes all files and directories, and the `-h` flag displays the sizes in a human-readable format (e.g., 1K, 1M, 1G).

- `sort -rh`: This command sorts the output of the previous command in reverse order (`-r`) based on the file sizes (`-h`).

- `head -n 10`: This command displays the first 10 lines of the sorted output, which will be the largest files in the directory.

You can replace `<directory>` with the path to the directory you want to search. For example, if you want to search the current directory, you can use `.` as the directory path.

Note that this command will only search for the largest files in the specified directory and its subdirectories. If you want to search for the largest files on your entire system, use the following command:


sudo find / -type f -printf "%s        %p \n" | sort -nr | head -10
0
2023-08-29
Linux
0
0
2023-08-29
Linux
0
0

Contact Us

If you have any inquiries or feedback, please don't hesitate to reach out to us at [email protected]. We will respond to your request as soon as possible. Thank you very much for your interest!

Country profiles