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.

HomeCertificationsLPIC-1DomainsShells, Scripting and Data Management
LPIC-1Free — No Signup

Shells, Scripting and Data Management

Practice LPIC-1 Shells, Scripting and Data Management questions with full explanations on every answer.

57questions

Start practicing

Shells, Scripting and Data Management — choose a session length

10 questions~10 min20 questions~20 min30 questions~30 min50 questions~50 min

Free · No account required

LPIC-1 Domains

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

Practice Shells, Scripting and Data Management questions

10Q20Q30Q50Q

All LPIC-1 Shells, Scripting and Data Management questions (57)

Start session

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

1

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?

2

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?

3

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?

4

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

5

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

6

Which THREE statements are true about the sed command?

7

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?

8

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?

9

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?

10

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

11

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?

12

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

13

Match each package manager to its associated distribution family.

14

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

15

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

16

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?

17

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

18

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?

19

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?

20

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

21

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

22

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

23

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

24

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

25

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

26

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?

27

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

28

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

29

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

30

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?

31

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?

32

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

33

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?

34

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?

35

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

36

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

37

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

38

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)

39

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)

40

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

41

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?

42

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?

43

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

44

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?

45

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?

46

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

47

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?

48

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?

49

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

50

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

51

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?

52

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?

53

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?

54

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?

55

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

56

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

57

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

Other LPIC-1 exam domains

GNU and Unix CommandsDevices, Filesystems and FHSLinux Installation and Package ManagementEssential System Services and NetworkingAdministrative TasksSystem Architecture

Frequently asked questions

What does the Shells, Scripting and Data Management domain cover on the LPIC-1 exam?

The Shells, Scripting and Data Management domain covers the key concepts tested in this area of the LPIC-1 exam blueprint published by LPI. Courseiva provides free domain-focused practice, mock exams, missed-question review, and readiness tracking across all LPIC-1 domains — no account required.

How many Shells, Scripting and Data Management questions are in the LPIC-1 question bank?

The Courseiva LPIC-1 question bank contains 57 questions in the Shells, Scripting and Data Management domain. Click any question to see the full explanation and answer breakdown.

What is the best way to practice Shells, Scripting and Data Management for LPIC-1?

Start with a 10-question focused session to identify your baseline accuracy in this domain. Read every explanation — even for questions you answer correctly — to understand the reasoning. Once you score consistently above 80%, move to a 20–30 question session to confirm depth before moving to the next domain.

Can I practice only Shells, Scripting and Data Management questions for LPIC-1?

Yes — the session launcher on this page draws questions exclusively from the Shells, Scripting and Data Management domain. Choose 10, 20, 30, or 50 questions for a focused session, or click individual questions to review them one by one.

Free forever · No credit card required

Track your LPIC-1 domain progress

Save your results, see per-domain analytics, and get readiness scores — free, for every certification.

Sign Up Free

Free forever · Every certification included

Practice Session

10 questions20 questions30 questions50 questions

Study Resources

All DomainsPractice TestMock ExamFlashcardsStudy Guide