Linux File System Navigation 3 — Questions and Answers
Question 1: What does the `..` path component represent in Linux?
- The parent directory (Correct answer)
- The current directory
- The root directory
- The home directory
Correct answer: The parent directory
`..` is a special directory entry that always refers to the parent of the current directory.
Question 2: Which command shows a tree-like view of a directory structure?
- tree (Correct answer)
- ls -R
- find -tree
- dir -t
Correct answer: tree
The `tree` command recursively lists directories in a branching visual tree format.
Question 3: What is the result of running `cd ~username` in bash?
- Changes to the home directory of the specified user (Correct answer)
- Creates a new directory named ~username
- Lists the contents of a user's home directory
- Returns an error unless run as root
Correct answer: Changes to the home directory of the specified user
`cd ~username` expands to the home directory of the named user and navigates there.
Question 4: Which directory typically contains user-installed binary executables on a Linux system?
- /usr/local/bin (Correct answer)
- /sys/bin
- /var/bin
- /lib/bin
Correct answer: /usr/local/bin
`/usr/local/bin` is the conventional location for locally compiled or manually installed binaries.
Question 5: What flag makes `ls` display file sizes in human-readable format (e.g., KB, MB)?
- -h (Correct answer)
- -r
- -s
- -k
Correct answer: -h
The `-h` (human-readable) flag causes `ls -lh` to display sizes in K, M, G units instead of raw bytes.
Question 6: Which `/proc` entry provides the current working directory of a running process with PID 1234?
- /proc/1234/cwd (Correct answer)
- /proc/1234/pwd
- /proc/1234/dir
- /proc/1234/path
Correct answer: /proc/1234/cwd
`/proc/<PID>/cwd` is a symbolic link pointing to the process's current working directory.
Question 7: What does `pushd /tmp` do compared to `cd /tmp`?
- Changes to /tmp and saves the previous directory on a stack (Correct answer)
- Changes to /tmp and deletes the previous directory
- Moves files to /tmp
- Changes to /tmp without updating $PWD
Correct answer: Changes to /tmp and saves the previous directory on a stack
`pushd` saves the current directory onto a stack before changing, allowing `popd` to return to it later.
What does the `..` path component represent in Linux?