010-160 Exam Questions & Answers
Linux Essentials - Exam 010, (version 1.6) • LPI
100% money-back guarantee
Sample 010-160 Questions
Practice with real exam-style questions, each with the verified correct answer and explanation.
The current directory contains the following file:
-rwxr-xr-x 1 root root 859688 Feb 7 08:15 test.sh
Given that the file is a valid shell script, how can this script be executed? (Choose two correct answers.)
A shell script is a file that contains a series of commands that can be executed by a shell interpreter. To execute a shell script, there are two main methods:
Method 1: Specify the path to the script file. This method requires that the script file has the execute permission, which can be granted by using the chmod command. The script file also needs to have a shebang line at the beginning, which indicates which interpreter to use for the script. For example, #!/bin/bash means to use the bash interpreter. To execute the script using this method, you can type the absolute path or the relative path to the script file. If you are in the same directory as the script file, you can use the ./ prefix to indicate the current directory. For example, ./test.sh will execute the test.sh script in the current directory.
Method 2: Pass the script file as an argument to the interpreter. This method does not require the execute permission or the shebang line for the script file. You can simply use the name of the interpreter followed by the script file name as an argument. For example, bash test.sh will execute the test.sh script using the bash interpreter.
Therefore, the correct answers are D and E. A. run test.sh is incorrect because run is not a valid command in Linux. B. ${test.sh} is incorrect because this syntax is used for variable expansion, not for executing a script. C. cmd ./test.sh is incorrect because cmd is not a valid command in Linux.Reference:
Linux Essentials Topic 105: The Power of the Command Line, section 105.3: Basic shell scripting.
How to Run a Shell Script in Linux [Essentials Explained] - It's FOSS
How To Execute a Command with a Shell Script in Linux | DigitalOcean
FILL in BLANK
What keyword is used in a shell script to begin a loop? (Specify one keyword only, without any additional
information.)
The keyword for is used in a shell script to begin a loop that iterates over a list of items or a range of numbers. The syntax of the for loop is as follows:
for <var> in <list> do <commands> done
Which of the following values could be a process ID on Linux?
A process ID on Linux is a unique integer value that identifies a running process. The process ID can range from 0 to a maximum limit, which is usually 32768 or higher, depending on the system configuration. The process ID of 0 is reserved for the kernel's idle task, and the process ID of 1 is reserved for the init system, which is the first process launched by the kernel. The process IDs are assigned sequentially to new processes, and are recycled when a process terminates. Therefore, the only valid value for a process ID among the given options is 21398, which is an integer within the possible range. The other values are not valid process IDs because they are either strings, hexadecimal numbers, or file paths, which do not match the format of a process ID on Linux.Reference:
Which command adds the new user tux and creates the user's home directory with default configuration
files?
Linux Essentials Version 1.6 Objectives, Topic 1.4: Command Line Basics, Subtopic: Basic Shell Commands
Linux Essentials Version 1.6 Exam Preparation Guide, Section 1.4: Command Line Basics, Page 16
Linux useradd Command Tutorial for Beginners (15 Examples)
Most commands on Linux can display information on their usage. How can this information typically be displayed?
Most commands on Linux can display information on their usage by running the command with the option -h or --help. This option shows a brief summary of the command syntax, options, arguments, and examples. For example, runningls -horls --helpwill display the usage information for the ls command, which lists files and directories. The -h or --help option is a standard convention for most Linux commands, and it is useful for learning how to use a command or checking its available options. However, some commands may not support this option, or may use a different option to display usage information. In that case, you can use the man command to access the manual page for the command, which provides more detailed information on the command usage, description, options, arguments, examples, and references. For example, runningman lswill display the manual page for the ls command. The man command is one of the applications covered in the Linux Essentials certification program from the Linux Professional Institute (LPI).Reference:
Linux Essentials - Linux Professional Institute (LPI)
Linux Commands Cheat Sheet: Beginner to Advanced - GeeksforGeeks
Get access to all 81 verified questions with detailed answers.
Unlock All 010-160 Questions