LPIC-1 · topic practice

GNU and Unix Commands practice questions

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.

Courseiva uses original exam-style practice questions designed for learning and revision. The goal is to understand the concepts, recognise exam patterns, and improve through explanations — not memorise copied exam dumps.

Reviewed byJohnson Ajibi· MSc IT Security
20 questionsDomain: GNU and Unix Commands

What the exam tests

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.

Practice set

GNU and Unix Commands questions

20 questions · select your answer, then reveal the explanation

A 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?

Which TWO commands can be used to view the contents of a compressed file named archive.tar.gz without extracting it to disk?

Refer 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?

Network Topology
-rw-rrRefer to the exhibit.# ls -l# cat /etc/example.conf# Configuration filesetting1=default# Include other configinclude /etc/example.d/*.conf

You 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?

Arrange the steps to configure a static IP address on a Linux system using the command line.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

Order the steps to recover a forgotten root password on a Linux system.

Drag steps to the numbered slots on the right, or tap a step then tap a slot.

Steps
Order
1Step 1
2Step 2
3Step 3
4Step 4
5Step 5

Match each Linux runlevel to its typical description.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

Halt

Single-user mode

Multi-user with networking

Multi-user with GUI

Reboot

Match each device file naming pattern to its device type.

Drag a concept onto its matching description — or click a concept then click the description.

Concepts
Matches

First SCSI/SATA disk

First NVMe SSD

First serial port (COM1)

First loopback device

First software RAID device

A 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?

An administrator wants to change the ownership of a file to user 'jane' and group 'staff'. Which command should be used?

A 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?

An administrator needs to copy a directory hierarchy from one server to another over SSH, preserving permissions, ownership, and timestamps. Which command is most appropriate?

An 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?

Question 14hardmultiple choice
Read the full NAT/PAT explanation →

A 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?

Refer to the exhibit. Which file has a special permission that allows a user to execute the file with the privileges of the file owner?

Exhibit

-rwxr-xr-x 1 root root 12345 Jan 1 12:00 /usr/bin/myapp
-rwsr-xr-x 1 root root 23456 Jan 1 12:00 /usr/bin/su
-rw-rw-rw- 1 user1 user1 0 Jan 1 12:00 /tmp/shared

Refer to the exhibit. The process with PID 1234 is in state 'Z'. What is the most likely cause and appropriate action?

Exhibit

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.1  22564  4500 ?        Ss   Jan01   0:00 /sbin/init
user1      1234  0.0  0.0      0     0 ?        Z    Jan01   0:00 [defunct]
user1      1235  0.0  0.1  12345  2000 ?        S    Jan01   0:00 bash

Refer to the exhibit. Which file system is full and what is the likely consequence if the administrator does not take action?

Exhibit

Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda1       10485760 9437184   1048576  90% /
/dev/sdb1       20971520 20971520       0 100% /var

Which TWO commands can be used to display the contents of a compressed file without decompressing it to disk? (Choose two.)

Which 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.)

Which THREE of the following are correct features of the 'grep' command? (Choose three.)

Free account

Track your progress over time

Create a free account to save your results and see which topics improve across sessions.

Focused GNU and Unix Commands sessions

Start a GNU and Unix Commands only practice session

Every question in these sessions is drawn from the GNU and Unix Commands domain — nothing else.

Related practice questions

Related LPIC-1 topic practice pages

Move into related areas when this topic feels solid.

Frequently asked questions

What does the LPIC-1 exam test 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 should I use these practice questions?
Select your answer before revealing the explanation. Then read why each option is right or wrong — this active recall approach builds retention far faster than re-reading notes.
Can I practise just GNU and Unix Commands questions in a focused session?
Yes — the session launcher on this page draws every question from the GNU and Unix Commands domain. Use a 10-question session first to gauge your baseline, then move to 20 or 30 once the weak spots are clear.
Where can I practise other LPIC-1 topics?
Use the topic links above to move to related areas, or go back to the LPIC-1 question bank to see all topics.
Are these real exam questions or dumps?
These are original practice questions written to test the same concepts the LPIC-1 exam covers. They are not copied from any real exam or dump site.