CodeYourFuture / CodeYourFuture/immersive-go-course
Find the largest file on the filesystem
- Dominant language
- Go
- Stars
- 157
- Forks
- 107
- PR merge metrics
- No merged PRs in 30d
Description
## 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
Contributor guide
Assessment
This issue has not been assessed yet.