Stage 2: Command Adventurer
You will be introduced to the essential Linux commands for navigation, file handling, and text processing. Build confidence in using the terminal and prepare them for command‑based interview questions.
Hackbook Overview
1. Navigating the File System
- pwd: Print current working directory.
- ls: List files and directories.
- cd: Change directory.
2. File and Directory Management
- touch: Create empty files.
- mkdir: Create directories.
- rm: Remove files.
- rmdir: Remove directories.
- cp: Copy files.
- mv: Move or rename files.
3. Viewing and Editing Files
- cat: Display file contents.
- less/more: View files page by page.
- nano/vi: Edit files directly in terminal.
4. Searching and Filtering
- grep: Search text patterns in files.
- find: Locate files and directories.
- wc: Count words, lines, characters.
5. Why This Matters in Interviews
- Interviewers often ask candidates to demonstrate basic command usage.
- Shows practical ability to navigate and manipulate Linux systems.
Hands‑On Practice
- Create a directory
practice_dirand a filenotes.txtinside it. - Add text to
notes.txtusingecho "Hello Linux" > notes.txt. - Use
grep "Linux" notes.txtto search for the word. - Rename
notes.txttolinux_notes.txtusingmv. - Delete the file and directory safely.
Interview Question Bank
Conceptual
- Q1. What command shows your current directory?
A1.pwdprints the current working directory path. - Q2. How do you list hidden files in Linux?
A2. Usels -ato display all files, including hidden ones starting with.. - Q3. What’s the difference between
rmandrmdir?
A3.rmremoves files (and directories with-r), whilermdirremoves empty directories only.
Practical
- Q4. How do you search for the word “error” inside a log file?
A4. Rungrep "error" logfile.log. - Q5. How do you count the number of lines in a file?
A5. Usewc -l filename. - Q6. How do you copy a file from one directory to another?
A6. Runcp source.txt /path/to/destination/.
Scenario‑Based
- Q7. You need to find all
.conffiles under/etc. What command do you use?
A7.find /etc -name "*.conf". - Q8. A file is too large to view at once. How do you read it efficiently?
A8. Useless filenameto scroll through the file page by page. - Q9. You accidentally deleted a file with
rm. Can you recover it?
A9. Not directly —rmpermanently deletes files unless backups or snapshots exist.
Behavioral Based
- Q10. Tell me about a time you used Linux commands to solve a problem.
A10. Example: “I usedgrepandfindto quickly locate misconfigured files during a deployment, saving hours of manual search.”
Cheatsheet (Quick Notes)
- Navigation:
pwd,ls,cd - File Management:
touch,mkdir,rm,cp,mv - Viewing:
cat,less,nano,vi - Search:
grep,find,wc - Hidden Files:
ls -a

Updated on Dec 21, 2025