LPIC-1 · domain
GNU and Unix Commands
Practise Linux Professional Institute Certification Level 1 LPIC-1 GNU and Unix Commands practice questions — original exam-style scenarios with answer choices, explanations, and analysis of common mistakes.
Focused practice
Practice GNU and Unix Commands questions
Scored sessions drawing only from this domain — pick a length below.
Start 20-question practice test →What this domain covers
What to know about GNU and Unix Commands
GNU and Unix Commands questions test whether you can apply the concept in context, not just recognise a definition.
How the topic appears in realistic exam-style scenarios.
Which detail in the question changes the correct answer.
How to eliminate plausible but wrong options.
How to connect the question back to the wider exam objective.
Watch out for
Common GNU and Unix Commands exam traps
- ▸Answering from memory before reading the full scenario.
- ▸Missing a constraint such as cost, availability, security, scope or command context.
- ▸Choosing a broad answer when the question asks for the most specific fix.
- ▸Ignoring why the wrong options are tempting.
Question index
All GNU and Unix Commands questions (43)
Click any question to see the full explanation, or start a practice session above.
Refer to the exhibit. The process with PID 1234 is in state 'Z'. What is the most likely cause and appropriate action?
Hard2Match each device file naming pattern to its device type.
Medium3A systems administrator needs to change the permissions of the file /home/user/script.sh so that the owner can read, write, and execute; the group can read and execute; and others have no access. Which command accomplishes this?
Medium4Which THREE of the following are correct features of the 'grep' command? (Choose three.)
Easy5Which command is used to compress a file with the highest compression ratio?
Medium6Order the steps to recover a forgotten root password on a Linux system.
Medium7Refer to the exhibit. A user reports that the 'myapp' command fails to run. Based on the output, what is the most likely cause?
Hard8Which TWO of the following are valid methods to run a shell script named 'script.sh' using the bash shell, assuming the script has execute permission? (Choose two.)
Hard9Which TWO commands can be used to display the contents of a compressed text file (e.g., .gz, .bz2) directly to standard output without decompressing to disk?
Medium10Match each Linux runlevel to its typical description.
Medium11Refer to the exhibit. Which file system is full and what is the likely consequence if the administrator does not take action?
Easy12Refer to the exhibit. When will the backup script run?
Medium13After receiving a compressed tarball archive.tar.gz from a colleague, you want to list its contents without extracting. Which command should you use?
Medium14Refer to the exhibit. Which file has a special permission that allows a user to execute the file with the privileges of the file owner?
Medium15An administrator needs to copy a directory hierarchy from one server to another over SSH, preserving permissions, ownership, and timestamps. Which command is most appropriate?
Medium16Arrange the steps to configure a static IP address on a Linux system using the command line.
Medium17Refer to the exhibit. A user runs 'python --version' and gets 'Python 3.9.1'. Which command would run Python 2 instead?
Medium18An administrator runs the command 'find / -name "*.conf" 2>/dev/null | head -n 10' and notices that the command returns very quickly. Which statement best describes what happened?
Hard19Refer to the exhibit. The /var partition is nearly full. Which of the following is the most appropriate first step to free up space?
Hard20A system administrator notices that the system's syslog messages are not being written to /var/log/messages. The rsyslog service is running. The administrator wants to check the configuration syntax of rsyslog. Which command should be used?
Medium21Which TWO commands can be used to view the contents of a compressed file named archive.tar.gz without extracting it to disk?
Easy22A script uses 'set -e' and then executes 'grep pattern file'. If the pattern is not found, the script exits. Which of the following modifications would prevent the script from exiting while still allowing detection of the pattern's absence?
Hard23A system administrator wants to list all files in a directory that have been modified in the last 24 hours. Which command would be most appropriate?
Easy24Which TWO commands can be used to display the contents of a compressed file without decompressing it to disk? (Choose two.)
Medium25Refer to the exhibit. What will be the default permissions of a newly created file using the touch command?
Medium26Which THREE of the following are valid symbolic mode expressions for the chmod command?
Hard27A web server runs Apache and generates extensive access logs. To conserve disk space, an administrator sets up a cron job that runs nightly at 2:00 AM. The job executes a shell script located at /usr/local/bin/rotate_logs.sh. The script is intended to find all .log files in /var/log/apache2/ that are older than 7 days, compress them with gzip, and move the compressed files to /var/log/archive/. However, after several days, the administrator notices that the /var/log partition is nearly full and the logs are not being compressed. The cron log shows the job ran at the scheduled time but produced no terminal output (stdout or stderr). The script itself contains no explicit echo statements or error handling. The administrator has root access and wants to diagnose the problem without disrupting the running web server. Which of the following is the most appropriate first step to identify the failure?
Hard28You are a Linux administrator for a company that runs a web server on a system with limited disk space. The web server logs are stored in /var/log/httpd/access_log and grow quickly. The operations team requires that the most recent logs be available for troubleshooting, but logs older than 7 days must be compressed to save space. You decide to implement log rotation using logrotate. The logrotate configuration file for httpd currently contains: /var/log/httpd/*.log { daily rotate 7 compress delaycompress missingok notifempty sharedscripts postrotate /bin/systemctl reload httpd 2>/dev/null || true endscript } After applying this configuration, you notice that log files are being compressed immediately instead of after one rotation. What is the most likely cause and the correct step to fix this?
Medium29Refer to the exhibit. The system fails to boot with an error 'UUID=e5f6g7h8 not found'. Which is the most likely cause?
Hard30Refer to the exhibit. An administrator needs to edit /etc/example.conf to change setting1 to 'production' and add a new line 'setting2=value' after the include line. The file must be edited in place without creating a backup. Which command sequence achieves this?
Hard31Refer to the exhibit. Which users are allowed to use the 'at' command?
Medium32Which TWO of the following commands output the total number of lines in a file?
Easy33Refer to the exhibit. The remount command fails. What is the most likely cause?
Hard34A developer wants to change the ownership of all files in a directory tree to the user 'www-data' and group 'www-data', but only files that are currently owned by user 'nobody'. Which command accomplishes this?
Hard35Refer to the exhibit. Which of the following is true about SSH access to this server?
Hard36A developer is troubleshooting a shell script that uses the variable $HOME but it outputs nothing when the script runs. The script is executed with ./script.sh from an interactive shell. What is the most likely cause?
Medium37A user reports that when they run 'ls -l' in their home directory, they see files but all files have permissions like '-rwxrwxrwx', which is unexpected. The system administrator checks and finds that the user's umask is set to 000. The user wants all new files to be created with default permissions of -rw-r--r-- (644) and directories that are drwxr-xr-x (755). What should the user set their umask to?
Easy38Refer to the exhibit. What is the expected outcome of the kill command?
Medium39Refer to the exhibit. What type of traffic is being captured?
Hard40Refer to the exhibit. Which statement is true about SSH root login on this server?
Medium41A company runs a legacy application on a Linux server. The application fails to start after a reboot, claiming a 'cannot open shared object file' error. The system administrator checks the library path and finds that the required library is present in /usr/local/lib but the application cannot find it. The administrator has verified that the library file exists and is readable. Which of the following is the most likely cause and solution?
Hard42A systems administrator needs to find all files in /var/log that were modified in the last 24 hours and contain the word 'error'. Which command accomplishes this?
Easy43An administrator wants to change the ownership of a file to user 'jane' and group 'staff'. Which command should be used?
EasyOther domains
All LPIC-1 exam domains
Frequently asked questions
- What does the GNU and Unix Commands domain cover on the LPIC-1 exam?
- GNU and Unix Commands questions test whether you can apply the concept in context, not just recognise a definition.
- How many questions are in this domain?
- This page lists all 43 GNU and Unix Commands questions in the LPIC-1 question bank. The actual exam draws from this domain proportionally to its weighting in the official exam blueprint.
- What is the best way to practise this domain?
- Start with a short focused session (10 questions) to identify gaps, then work through explanations. Repeat with a longer session once the weak areas feel solid.
- Can I practise only GNU and Unix Commands questions?
- Yes — the session launcher on this page filters questions to this domain only. Choose any session length for inline explanations and scoring.