1 / 2 · Book 19 · The Linux Directory Structure · drill: interview Q&A⊞ allnext →Get the book →
1.6Exercises
Beginner
- Open a terminal and run
pwdto see your current directory. Then navigate to/var/log/and list the files. Identify which logs belong to which service. - Navigate to your home directory and list all files, including hidden ones (
ls -la). Identify the dotfiles (files starting with.) and guess what each one is for. - Create the following directory structure using a single
mkdir -pcommand:~/qa-practice/tests/unit/,~/qa-practice/tests/integration/,~/qa-practice/tests/e2e/.
Intermediate
- Find all
.logfiles modified in the last 24 hours anywhere on the system usingfind. - Check disk usage on your machine with
df -h. Which filesystem is the fullest? Usedu -h --max-depth=1on a large directory to find what is taking up space. - Create a file in
/tmp/, verify it exists, reboot your machine (or wait until the next reboot), and check if the file still exists. Explain why.
Advanced
- Use
tail -fto monitor a log file in real-time while performing an action that generates log entries in another terminal window. - Write a command that finds the 10 largest files anywhere on the system and displays their sizes in human-readable format.
- Use
findto locate all files larger than 50MB that have not been accessed in the last 30 days. Consider how this could be used for disk cleanup on CI runners.