LPIC-1 · topic practice

Shells, Scripting and Data Management practice questions

Practise Linux Professional Institute Certification Level 1 LPIC-1 Shells, Scripting and Data Management 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: Shells, Scripting and Data Management

What the exam tests

What to know about Shells, Scripting and Data Management

Shells, Scripting and Data Management 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 Shells, Scripting and Data Management 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

Shells, Scripting and Data Management questions

20 questions · select your answer, then reveal the explanation

A system administrator writes a script that extracts data from a CSV file and inserts it into a database. The script works correctly when run manually but fails when executed by cron. Which environment variable is most likely causing the issue?

A developer needs to ensure a bash script exits immediately if any command fails, and also prints each command before executing it. Which set of shell options should be used at the beginning of the script?

A script contains the following line: for i in $(cat file.txt); do echo $i; done. The file file.txt contains a single line with multiple words. How many times will the loop execute?

Refer to the exhibit. Why does the cron job fail?

Network Topology
-rw-rrRefer to the exhibit.$ cat /etc/cron.d/backup$ ls -l /usr/local/bin/backup.sh$ su -c '/usr/local/bin/backup.sh' --bash: /usr/local/bin/backup.sh: Permission denied

Which TWO commands can be used to sort the output of ps -ef by the resident set size (RSS) in descending order?

Which THREE statements are true about the sed command?

A cron job is configured to run a script every day at 2:30 AM. The sysadmin notices the job runs but produces no output. Which is the most likely reason?

A systems administrator is responsible for a Linux server that runs a custom application. The application writes logs to /var/log/app.log and rotates them using logrotate. Recently, the server ran out of disk space because log files were not being rotated. The administrator checks the logrotate configuration file /etc/logrotate.d/app and finds:

/var/log/app.log { weekly rotate 4 compress missingok notifempty

}

The administrator manually runs 'logrotate -f /etc/logrotate.d/app' and the log rotates successfully. However, the next day, the log is not rotated again. The administrator checks the cron job for logrotate and finds that /etc/cron.daily/logrotate exists and runs logrotate /etc/logrotate.conf. The administrator checks /etc/logrotate.conf and sees that it includes /etc/logrotate.d/*. What is the most likely reason the log is not rotating automatically?

A system administrator needs to ensure that a bash script continues executing even if any command in the script fails. Which of the following should be used at the beginning of the script?

Which TWO commands can be used to count the number of lines in a file named 'data.txt'?

A user reports that running '/usr/local/bin/myapp' from the command line results in 'bash: /usr/local/bin/myapp: No such file or directory'. The exhibit shows the file exists and is a valid executable. What is the most likely cause of the error?

Exhibit

Refer to the exhibit.
$ ls -l /usr/local/bin/myapp
-rwxr-xr-x 1 root root 12345 Jan 1 12:00 /usr/local/bin/myapp
$ file /usr/local/bin/myapp
/usr/local/bin/myapp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, stripped
$ ldd /usr/local/bin/myapp
	linux-vdso.so.1 (0x00007ffe5a3b0000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f9a8b200000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f9a8b600000)

Order the steps to add a new user to the system and grant sudo privileges.

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 package manager to its associated distribution family.

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

Concepts
Matches

Debian, Ubuntu

RHEL, CentOS 7

Fedora, RHEL 8+

openSUSE

Arch Linux

An administrator wants to list all lines in a log file that do NOT contain the word 'ERROR'. Which command should be used?

Question 15mediummultiple choice
Read the full network assurance explanation →

In a bash script, a variable 'file' is set to '/var/log/syslog'. Which expansion will yield the string '/var/log'?

A script uses a while loop to read lines from a file, but a variable set inside the loop is empty after the loop finishes. What is the most likely cause?

Which sed command will replace the first occurrence of 'foo' with 'bar' on each line of a file?

Given a file with lines like 'John:23:Engineer', which awk command prints only the name and department (first and third fields) separated by a space?

A script uses a here-document to pass multi-line input to a command. Which here-document syntax will prevent variable expansion inside the document?

Question 20easymultiple choice
Read the full NAT/PAT explanation →

Which command combination will display a sorted list of unique lines from a file?

Free account

Track your progress over time

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

Focused Shells, Scripting and Data Management sessions

Start a Shells, Scripting and Data Management only practice session

Every question in these sessions is drawn from the Shells, Scripting and Data Management 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 Shells, Scripting and Data Management?
Shells, Scripting and Data Management 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 Shells, Scripting and Data Management questions in a focused session?
Yes — the session launcher on this page draws every question from the Shells, Scripting and Data Management 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.