Courseiva
Knowledge + Practice
CertificationsVendorsCareer RoadmapsLabs & ToolsStudy GuidesGlossaryPractice Questions
C
Courseiva

Free IT certification practice questions with explained answers for CCNA, CompTIA, AWS, Azure, Google Cloud, and more.

Certification Practice Questions

CCNA practice questionsSecurity+ SY0-701 practice questionsAWS SAA-C03 practice questionsAZ-104 practice questionsAZ-900 practice questionsCLF-C02 practice questionsA+ Core 1 practice questionsGoogle Cloud ACE practice questionsCySA+ CS0-003 practice questionsNetwork+ N10-009 practice questions
View all certifications →

Product

CertificationsCertification PathsExam TopicsPractice TestsExam Dumps vs Practice TestsStudy HubComparisons

Company

AboutContactEditorial PolicyQuestion Writing PolicyTrust Center

Legal

Privacy PolicyTerms of Service

Courseiva is a free IT certification practice platform offering original exam-style practice questions, detailed explanations, topic-based practice, mock exams, readiness tracking, and study analytics for Cisco, CompTIA, Microsoft, AWS, and other technology certifications.

© 2026 Courseiva. Courseiva is operated by JTNetSolutions Ltd. All rights reserved.

Courseiva is an independent certification practice platform and is not affiliated with, endorsed by, or sponsored by Cisco, Microsoft, AWS, CompTIA, Google, ISC2, ISACA, or any other certification vendor. Vendor names and certification marks are used only to identify the exams learners are preparing for.

← Shells, Scripting and Data Management practice sets

LPIC-1 Shells, Scripting and Data Management • Complete Question Bank

LPIC-1 Shells, Scripting and Data Management — All Questions With Answers

Complete LPIC-1 Shells, Scripting and Data Management question bank — all 0 questions with answers and detailed explanations.

57
Questions
Free
No signup
Certifications/LPIC-1/Practice Test/Shells, Scripting and Data Management/All Questions
Question 1mediummultiple choice
Read the full Shells, Scripting and Data Management 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?

Question 2hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 3easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 4hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

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
Question 5mediummulti select
Read the full Shells, Scripting and Data Management explanation →

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

Question 6hardmulti select
Read the full Shells, Scripting and Data Management explanation →

Which THREE statements are true about the sed command?

Question 7easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 8mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 9mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 10hardmulti select
Read the full Shells, Scripting and Data Management explanation →

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

Question 11easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

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)
Question 12mediumdrag order
Read the full Shells, Scripting and Data Management explanation →

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
Question 13mediummatching
Read the full Shells, Scripting and Data Management explanation →

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

Question 14easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

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

Question 16hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 17easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

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

Question 18mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 19hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

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?

Question 21mediummultiple choice
Read the full NAT/PAT explanation →

Which command returns the directory part of a full path like '/home/user/script.sh'?

Question 22hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

A script reads a CSV file where fields may contain commas within quoted strings. Which approach correctly parses such fields?

Question 23mediummulti select
Read the full Shells, Scripting and Data Management explanation →

Which TWO of the following are required for a bash script to be executed by the shell (assuming the script is in the current directory)?

Question 24mediummulti select
Read the full Shells, Scripting and Data Management explanation →

Which THREE of the following commands can be used to transform delimited text (e.g., CSV) by selecting specific fields or columns?

Question 25mediummulti select
Read the full Shells, Scripting and Data Management explanation →

Which TWO of the following are true about the 'source' command in bash?

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

Refer to the exhibit. An administrator installed a new command in /opt/bin/ but cannot run it without specifying the full path. What is the likely cause?

Exhibit

The output of 'set | grep -i path' returns:
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Question 27mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

Refer to the exhibit. What will be the output when this script is executed?

Exhibit

Consider the following script named 'parse.sh':

#!/bin/bash
while IFS=',' read -r field1 field2 remainder; do
	echo "$field1 $field2"
done < input.txt

Assume input.txt contains:
a,b,c
d,e,f
Question 28easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

Refer to the exhibit. When will the cron job execute?

Exhibit

The output of 'cat /etc/crontab' shows:
* * * * * root /usr/local/bin/backup.sh
Question 29easymultiple choice
Read the full network assurance explanation →

A system administrator wants to display all lines in /var/log/syslog that do NOT contain the string 'error'. Which command accomplishes this?

Question 30mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

A developer has a directory /home/user/project with many files and subdirectories. They need to change the group ownership of all .txt files to 'developers' and set permissions to 640. Which single command accomplishes this?

Question 31hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

A script produces both standard output and error messages. An administrator wants to save the output to 'out.log' and the error messages to 'err.log', but also wants to see both on the terminal. Which command achieves this?

Question 32easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

An administrator needs to replace all occurrences of 'old_host' with 'new_host' in the file /etc/hosts. Which sed command should be used?

Question 33mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

A log file access.log contains multiple entries per IP address. An administrator wants to display a list of unique IP addresses sorted by frequency (most frequent first). Which command pipeline achieves this?

Question 34hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

A directory contains files with spaces and special characters in their names. An administrator wants to delete all files older than 30 days using find and xargs. Which command is safe?

Question 35easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

A user frequently runs 'ls -la' and wants to create an alias 'll' for this command. Which command adds this alias persistently?

Question 36mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

A script running as a daemon should perform clean-up operations when it receives SIGTERM. Which command inside the script sets up this behavior?

Question 37hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

A script starts multiple background processes. An administrator wants to wait for all background jobs to complete before proceeding. Which command should be used?

Question 38easymulti select
Read the full Shells, Scripting and Data Management explanation →

An administrator needs to find files that have been modified within the last 24 hours. Which two parameters are valid for the find command to accomplish this? (Choose TWO)

Question 39hardmulti select
Read the full Shells, Scripting and Data Management explanation →

When writing a Bash script, which two constructs can be used to safely iterate over a list of filenames that may contain spaces or special characters? (Choose TWO)

Question 40mediummulti select
Read the full Shells, Scripting and Data Management explanation →

A sysadmin is tasked with configuring the shell environment for all users. Which three files are typically sourced by Bash during login? (Choose THREE)

Question 41hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

Refer to the exhibit. An administrator runs this command expecting to capture both stdout and stderr into output.txt. However, the file contains only stdout. What is the error?

Exhibit

command 2>&1 > output.txt
Question 42mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

Refer to the exhibit. An application uses this JSON policy to control execution of commands. If a user tries to run /usr/bin/passwd, what will happen?

Exhibit

{
  "allow": [{"action": "execute", "path": "/usr/bin/*"}],
  "deny": [{"action": "execute", "path": "/usr/bin/passwd"}]
}
Question 43easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

Refer to the exhibit. An administrator wants to unset the BASH_ALIASES associative array. Which command will correctly remove it?

Exhibit

$ set | grep -E ^BASH
BASH=/bin/bash
BASH_ALIASES=()
BASH_CMDS=()
BASH_LINENO=()
BASH_SOURCE=()
BASH_VERSION='5.0.0(1)-release'
Question 44easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

A user needs to schedule a backup script to run every weekday at 2:00 AM. Which command should they use to set up this recurring job?

Question 45mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

A shell script uses the variable expansion ${var:-default} to set a default value for an environment variable. The script prints unexpected output when the variable is set to an empty string. Which expansion should be used to ensure the default is only used when the variable is unset, not when it is empty?

Question 46hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

A script needs to remove all trailing whitespace (spaces and tabs) from each line of a file. Which sed command will accomplish this?

Question 47easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

Which shell loop is most appropriate for iterating over all files in a directory, performing an action only on regular files, while safely handling filenames with spaces?

Question 48mediummultiple choice
Read the full NAT/PAT explanation →

A system administrator wants to monitor a log file in real-time for lines containing 'ERROR' and write them to a separate file. Which command combination is most appropriate?

Question 49mediummulti select
Read the full NAT/PAT explanation →

Which TWO of the following commands can be used to replace text patterns in a file and output the result?

Question 50mediummulti select
Read the full Shells, Scripting and Data Management explanation →

Which THREE of the following are types of expansion performed by the bash shell during command parsing?

Question 51mediummultiple choice
Read the full NAT/PAT explanation →

A junior system administrator, Sarah, has written a shell script to automate a backup process on a Linux server. The script is located at /home/sarah/backup.sh and has execute permissions. The script contains the line 'mybackup /home/data'. The 'mybackup' command is installed in /usr/local/bin and works correctly when Sarah runs it from her interactive shell. However, when she runs the script using './backup.sh', it fails with the error 'line 5: mybackup: command not found'. Sarah has verified that /usr/local/bin is in her PATH by executing 'echo $PATH' in an interactive session. Which of the following is the most likely cause of this issue?

Question 52mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

A senior administrator runs a script that processes a CSV file. The script contains the following snippet: 'for field in $(cat data.csv); do ...'. The data.csv file contains lines like: 'John Doe, 123 Main St, Springfield'. The script fails to process correctly, splitting fields incorrectly and causing errors. Which of the following is the most appropriate fix?

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

A system administrator is tasked with migrating several shell scripts from a legacy UNIX system to a new Linux server. One script uses the command 'grep -E "pattern1|pattern2"' which works fine on the old system. However, on the new Linux server, the patterns are not being matched correctly. The administrator suspects it is due to differences in grep implementations. Which of the following is the most likely reason for the discrepancy?

Question 54easymultiple choice
Read the full Shells, Scripting and Data Management explanation →

A helpdesk technician receives a call about a user who is unable to run a script that was working yesterday. The user says they only changed the ownership of a file in their home directory. The script is located in /usr/local/bin and is owned by root:root. The script has permissions 755. Which of the following is the most likely cause of the issue?

Question 55easymulti select
Read the full Shells, Scripting and Data Management explanation →

Which TWO of the following are valid ways to capture the output of a command into a variable in Bash?

Question 56mediummultiple choice
Read the full Shells, Scripting and Data Management explanation →

Refer to the exhibit. A user gets this error when running a script. What is the most likely cause?

Exhibit

./script.sh: line 3: $'\r': command not found
Question 57hardmultiple choice
Read the full Shells, Scripting and Data Management explanation →

A systems administrator maintains a Linux web server running Apache HTTP Server (version 2.4) with three virtual hosts. The server logs are stored in /var/log/httpd/ and are rotated using logrotate, which is configured with the default settings that came with the Apache package. The administrator has noticed that after the nightly log rotation, the main access log file (access_log) is empty, while the rotated log files (e.g., access_log.1, access_log.2) contain the previous day's data. Furthermore, new HTTP requests are being logged into the most recent rotated file (access_log.1) instead of the current access_log file. The administrator has verified that the logrotate cron job runs successfully, and that the log files are owned by the root user with read/write permissions for the root group. No errors appear in the system logs. The Apache service continues to run and serve web pages. Which of the following actions should the administrator take to ensure that Apache writes new log entries to the current access_log file after rotation?

Practice tests

Scored 10-question sessions with instant feedback and explanations.

LPIC-1 Practice Test 1 — 10 Questions→LPIC-1 Practice Test 2 — 10 Questions→LPIC-1 Practice Test 3 — 10 Questions→LPIC-1 Practice Test 4 — 10 Questions→LPIC-1 Practice Test 5 — 10 Questions→LPIC-1 Practice Exam 1 — 20 Questions→LPIC-1 Practice Exam 2 — 20 Questions→LPIC-1 Practice Exam 3 — 20 Questions→LPIC-1 Practice Exam 4 — 20 Questions→Free LPIC-1 Practice Test 1 — 30 Questions→Free LPIC-1 Practice Test 2 — 30 Questions→Free LPIC-1 Practice Test 3 — 30 Questions→LPIC-1 Practice Questions 1 — 50 Questions→LPIC-1 Practice Questions 2 — 50 Questions→LPIC-1 Exam Simulation 1 — 100 Questions→

Practice by domain

Each domain maps to a weighted exam section. Focus on the domain where you are weakest.

GNU and Unix CommandsDevices, Filesystems and FHSLinux Installation and Package ManagementEssential System Services and NetworkingAdministrative TasksShells, Scripting and Data ManagementSystem Architecture

Practice by scenario

Filter questions by type — troubleshooting, exhibit, drag-and-drop, PBQ, ACLs, OSPF, and more.

Browse scenarios→

Continue studying

All Shells, Scripting and Data Management setsAll Shells, Scripting and Data Management questionsLPIC-1 Practice Hub