Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find the largest file on the filesystem #132

Open
Radha13 opened this issue Apr 27, 2023 · 0 comments
Open

Find the largest file on the filesystem #132

Radha13 opened this issue Apr 27, 2023 · 0 comments
Assignees

Comments

@Radha13
Copy link
Contributor

Radha13 commented Apr 27, 2023

Description

An exercise for the candidates to find the largest files on the filesystem on Linux.

Steps to setup

create a big file, there are many options - truncate or dd are most common but not limited.

dd if=/dev/zero of=/path/to/largefile bs=4k count=10G

OR

truncate -s 10G /path/to/largefile
(s for size)

Find the largest file

The simplest command to do that is to run du -h /*. The user can add sort -n to get the highest.

One can also us ls -lshR to search recursively.
(R for recursive, l for long list format, s for size, h for human readable)

Note: I didn't use df -h to find the partition first because it might the case there are multiple medium sized file in a partition all adding up to 11G but that doesn't mean this partition has the largest single file with size 10G

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant