Interview Q&A / Linux & Shell
Linux & Shell interview questions
Permissions, processes, pipes and the commands you are expected to know cold.
Prefer rapid revision? Practise Linux & Shell short interview answers →
- How do you search for text and files in Linux using grep and find?
grep searches inside files for lines matching a pattern, for example grep -rn "error" logs/. find searches the directory tree for files by name, type, size or age, for example find . -name "*.log" -mtime -1. They are often combined to search text inside a chosen set of files.
BeginnerIn-depth2 min read - What are environment variables in Linux, and what does the PATH variable do?
Environment variables are named values (like HOME, USER or PATH) that every process inherits from its parent. PATH is a colon-separated list of directories the shell searches, in order, to find a command you type, so you can run python3 instead of /usr/bin/python3.
BeginnerIn-depth3 min read - What is the difference between >, >>, 2>&1 and | in the Linux shell?
The > operator writes a command's output to a file and overwrites it, >> appends to the file, 2>&1 sends error output to the same place as normal output, and the pipe | feeds one command's output straight into the next command's input.
BeginnerIn-depth3 min read