Linux Command Line & Shell Scripting Flashcards
7 cards from real 010-160 practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Linux Command Line & Shell Scripting flashcards as text
What does the command tail -f /var/log/syslog do?
Answer: Continuously displays new lines appended to syslog
tail -f follows a file and prints new lines as they are written, useful for live log monitoring.
In a bash for loop, which syntax correctly iterates over the values 1 2 3?
Answer: for i in 1 2 3; do echo $i; done
Bash for loops use the syntax: for variable in list; do commands; done.
Which command prints the current working directory?
Answer: pwd
pwd (print working directory) outputs the absolute path of the current directory.
How do you redirect standard error (stderr) to a file named errors.txt?
Answer: command 2> errors.txt
File descriptor 2 refers to stderr, so 2> redirects error output to the specified file.
What character begins a comment in a bash script?
Answer: #
In bash, everything after # on a line is treated as a comment and ignored by the shell.
Which command makes a shell script named setup.sh executable?
Answer: chmod +x setup.sh
chmod +x adds the execute permission bit for all users on the specified file.
What does the command sort -r file.txt do?
Answer: Sorts file.txt in reverse (descending) order
sort -r reverses the default sort order, displaying lines from Z to A (or largest to smallest).