Courseiva

LPIC-1 · domain

GNU and Unix Commands

This domain covers working at the Linux command line: running commands, managing files and directories, redirecting input/output, using pipes and filters, editing text, and controlling permissions. LPIC-1 tests it through scenario questions, exhibits of terminal output, and ordering tasks such as configuring a static IP or setting exact file modes.

36 questions6 easy17 medium13 hard

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

Be able to run and locate commands, manage files and permissions, and redirect streams confidently. The single most important skill is reading a scenario and choosing the exact command and arguments, especially correct chmod mode syntax and redirection operators.

Running commands and locating executables with which, type, and PATH manipulation

File and directory operations using cp, mv, rm, mkdir, find, and tar

Stream redirection and pipes with >, >>, <, |, tee, and xargs

Permission and ownership control via chmod symbolic/octal modes, chown, and umask

Watch out for

Common GNU and Unix Commands exam traps

  • ▸Confusing chmod symbolic syntax: u, g, o, a with +, -, = and r, w, x; mixing commas and spaces incorrectly.
  • ▸Assuming python or python3 always points to a specific version instead of checking with which, type, or --version.
  • ▸Mixing up > (overwrite) and >> (append), or forgetting that 2> redirects stderr while 2>&1 merges it.

Question index

All GNU and Unix Commands questions (36)

Click any question to see the full explanation, or start a practice session above.

1

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

Hard
2

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?

Medium
3

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

Easy
4

An administrator is examining a file with 'ls -l' and sees the permission string '-rwSr--r--' on an executable owned by root. What does the capital S in the owner execute position indicate?

Hard
5

Which command is used to compress a file with the highest compression ratio?

Medium
6

Refer to the exhibit. A user reports that the 'myapp' command fails to run. Based on the output, what is the most likely cause?

Hard
7

Match each Linux runlevel to its typical description.

Medium
8

Refer to the exhibit. When will the backup script run?

Medium
9

After receiving a compressed tarball archive.tar.gz from a colleague, you want to list its contents without extracting. Which command should you use?

Medium
10

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?

Medium
11

A Linux administrator needs to change the permissions of a directory named /shared so that only the owner can read, write, and execute, while group members can read and execute but not write, and others have no access. The administrator also wants any new files created inside /shared to inherit the group ownership of /shared. Which command sequence will achieve this?

Hard
12

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

Medium
13

Refer to the exhibit. A user runs 'python --version' and gets 'Python 3.9.1'. Which command would run Python 2 instead?

Medium
14

A backup operator needs to archive the entire /srv/projects tree, preserving permissions, ownership, and directory structure, into a single compressed file that can later be unpacked on another Linux host. Which TWO commands correctly produce such an archive? (Choose two.)

Hard
15

A user runs the command 'grep -E '^[[:space:]]*[^#]' /etc/ssh/sshd_config' and receives no output. Which statement best explains this result?

Hard
16

Refer to the exhibit. The /var partition is nearly full. Which of the following is the most appropriate first step to free up space?

Hard
17

A help-desk technician must determine which shell built-in will display the absolute path of the directory the user is currently working in, so it can be captured in a support script. Which command should the technician use?

Easy
18

A Linux administrator needs to archive the /etc directory into a compressed tarball at /backup/etc_backup.tar.bz2. The administrator wants to see the progress of the archiving process as files are added. Which command should be used?

Medium
19

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

Medium
20

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

Easy
21

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

Medium
22

Refer to the exhibit. What will be the default permissions of a newly created file using the touch command?

Medium
23

A user wants to view the contents of a large text file one page at a time, with the ability to scroll both forward and backward. Which command should the user employ?

Easy
24

Which THREE of the following are valid symbolic mode expressions for the chmod command?

Hard
25

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

Hard
26

A Linux administrator needs to find all files in the /var/log directory that are larger than 10 MB and have not been accessed in the last 30 days. The administrator also wants to delete these files to free up space. Which command will accomplish this safely, prompting for confirmation before each deletion?

Hard
27

Refer to the exhibit. Which users are allowed to use the 'at' command?

Medium
28

Which TWO of the following commands output the total number of lines in a file?

Easy
29

Refer to the exhibit. The remount command fails. What is the most likely cause?

Hard
30

A developer needs to run a script named `backup.sh` every day at 02:30 using the system-wide cron facility. The system uses a traditional cron daemon and the file `/etc/crontab` contains a `SHELL` and `PATH` line. Which entry in `/etc/crontab` correctly schedules the script to run as user 'backup'?

Hard
31

A junior administrator needs to extract only the file 'etc/nginx/nginx.conf' from the archive 'backup.tar.bz2' into the current directory, preserving its path structure. Which command should be used?

Medium
32

A junior administrator is monitoring a long-running data migration and wants the 'df -h' output for the /data mount point to refresh automatically on screen every 5 seconds, replacing the previous output each time. Which command accomplishes this?

Medium
33

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

Easy
34

A junior administrator runs `ps aux` and sees a process owned by user 'deploy' with STAT code 'T'. The process is a long-running data migration script. The administrator wants to know what this status means and what will happen if no action is taken. Which statement correctly describes the process state?

Medium
35

Refer to the exhibit. Which statement is true about SSH root login on this server?

Medium
36

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

Hard

Frequently asked questions

What does the GNU and Unix Commands domain cover on the LPIC-1 exam?
Be able to run and locate commands, manage files and permissions, and redirect streams confidently. The single most important skill is reading a scenario and choosing the exact command and arguments, especially correct chmod mode syntax and redirection operators.
How many questions are in this domain?
This page lists all 36 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.
Linux Professional Institute Certification Level 1 LPIC-1 GNU and Unix Commands Practice Questions