While troubleshooting a server, you run `grep -r 'timeout' /etc/nginx/` and receive output that includes the filename and line number for every match. You now need to count only the total number of matching lines across all files, without displaying the matches themselves. Which command pipeline or option achieves this?
You are working in a directory containing a file named `report.txt`. You want to make a copy of this file named `report_backup.txt` in the same directory. Which command accomplishes this?
A developer runs a program that writes progress messages to standard error and results to standard output. They want to save only the results to results.txt while still seeing progress messages on the terminal. Which redirection accomplishes this?
You are examining a shell script and see the line `find /var/log -type f -name '*.log' -exec rm {} \;`. You want to modify this command so that it deletes matching files in a single rm invocation for better performance, while still handling filenames with spaces correctly. Which change should you make?
A user is editing a configuration file with vim and wants to save the changes and exit the editor immediately. Which command should they type in vim's command mode?
A system administrator needs to extract a specific file named 'config.yml' from a tarball 'app.tar.gz' without extracting the entire archive. Which command should be used?
You are troubleshooting a user's account and want to view the contents of the environment variable HOME without launching a subshell or external program. Which command displays its value?
A user wants to find all files under /home that are larger than 10 MB and were modified more than 30 days ago, then delete them. Which command sequence is correct?
A developer wants to run a script named `deploy.sh` in the background, keep it running after logging out, and ensure it continues even if the terminal is closed. Which command sequence is most appropriate?
You are writing a shell script and need to capture the standard output of a command into a variable, while also ensuring that any error messages are displayed on the terminal. Which TWO of the following approaches achieve this? (Choose two.)
A Linux administrator needs to identify the absolute pathname of the executable that would run if the user types the command 'grep' at the shell prompt. The administrator also wants to know the file type of that executable. Which TWO commands will provide this information? (Choose two.)
A system administrator needs to monitor a growing log file in real time and also filter the output to show only lines containing the word 'ERROR'. Which TWO commands or command combinations achieve this? (Choose two.)
A user wants to find all files in the /etc directory that have been modified in the last 24 hours and are larger than 1 MB. Which TWO commands will accomplish this? (Choose two.)
You wish to send the output of the 'ls -l' command directly into a file named 'dirlist.txt', overwriting any existing content. Which operator should you use?
A junior administrator runs `grep -r "timeout" /etc` inside a Bash login shell. The output scrolls past the terminal window, so the administrator wants to view the complete results one screen at a time while also being able to scroll back through the earlier lines. Which command should the administrator have used instead?
While troubleshooting a script, you run `grep -n 'error' /var/log/app.log` and see output lines prefixed with numbers. A colleague asks what those numbers represent. What do they indicate?
While troubleshooting a service, a technician runs `ps aux` and sees a process in state `Z`. The process's parent is PID 1. Which statement best describes what the technician is observing?
A user wants to find all files under /var/log that have been modified within the last 24 hours and are larger than 1 MB, then save the list to /tmp/recent_large.txt. Which command accomplishes this?
A user needs to find every regular file under /var/log whose name ends in `.log` and whose size is larger than 10 megabytes, then delete them. Which command accomplishes this safely?
You need to determine the absolute path of the `python3` executable that would run if you typed `python3` at the prompt. Which command displays this path?
A user wants to redirect the standard error of a command to a file named errors.txt while still displaying standard output on the terminal. Which redirection is correct?
A script named deploy.sh must run only when the preceding build command finishes without error. Which shell operator should you place between the two commands to achieve this?
A user runs `grep -E '^[A-Z][a-z]+ [0-9]{3}$' file.txt` and gets no output, even though file.txt contains lines like `Alpha 123` and `Beta 456`. What is the most likely explanation?
A colleague's shell script contains the line: find /var/log -name '*.log' -exec rm {} \; You need to explain what this line does before approving it. What is the effect of the -exec primary here?
You are reviewing a shell script and need to identify commands that are handled internally by the shell rather than by launching a separate executable. Which two of the following are shell builtins? (Choose two.)
A teammate wants to search a large text file for lines containing the word 'error', ignoring case, and display the matching line numbers. Which command accomplishes this?
A user wants to find all files in the /var/log directory that have been modified in the last 24 hours and display their names. Which command accomplishes this?
A user wants to create a compressed archive of the directory /home/user/project, including all its subdirectories, and name the archive project.tar.gz. Which command should be used?
A developer is exploring a new project directory and wants to see the names of all files and directories, including those that start with a dot (hidden files). Which command should be used?
A system administrator needs to change the permissions of a script named backup.sh so that the owner can read, write, and execute it, while group members and others can only read and execute it. Which command accomplishes this?
A user runs the command `grep '^root' /etc/passwd` and sees only the line starting with 'root'. They now want to find all lines that do NOT start with 'root'. Which command should they use?