NDG Linux Almost all Chapters 2022 (No chapter 1 sorry)
Which of the following commands will execute the last command that started with ec:
!ec
Which two characters represent the empty string?
"" (quotation marks)
Which of the following is not used for globbing?
# (hashtag)
To navigate to the end of the line in vi command mode, you can press:
$ (dollar sign)
If you want to overwrite a file by redirecting the output of a command, you can use:
>
If you want to append content to a file with the normal output of a command, you can use:
>>
Which glob character matches zero or more characters?
* (asterik)
Which regular expression character matches zero or more of the previous character?
* (asterik)
Which of the following files is specific to each user and executed every time a bash shell is opened?
* ~/.bashrc
Which of the following regular expression characters is an extended regular expression character?
+ (plus sign)
Long command options are preceded by which two characters?
-- (double dash)
Which two characters do you use to tell the command that you are finished providing options and that the remaining data on the command line is arguments?
-- (double dash)
Which option of the head command will display only the first six lines of a file?(choose two)
-6 -n 6
Which option to the find command will execute a command on each matching file without prompting the user?
-exec
If you want to use grep without regard to the capitalization of text, you can use the option:
-i
Which option to the locate command will have the command perform case-insensitive searches?
-i
Which option to the find command will search by name using a case-insensitive match?
-iname
To get the grep command to show the names of files that matched instead of the content that matched, you can use the option:
-l
Which option to the find command will display a long listing of matching files?
-ls
Which option to the find command will prompt the user to execute a command on each matching file?
-ok
To copy the contents of a directory, use the following option(s) for the cp command:(choose two)
-r -R
Which option to the ls command will sort the output by time-stamp?
-t
Which option to the find command will search by user owner?
-user
The names of hidden files begin with the ___ character.
. (period)
Which regular expression character matches any one character?
. (period)
An absolute path always starts with which character?
/ (forward slash)
To search for something while viewing a man page, you first type a __ character.
/ (forward slash)
To search forward from your cursor in your vi document in command mode, you can type __ followed by the pattern to search for.
/ (forward slash)
Which directory is used to store files representing attached devices?
/dev
Which directory is used to store configuration files specific to the host?
/etc
To redirect the errors that are output by a command, you can use:
2>
To send the normal and error output of a command to a single file, you can use:
2>&1
If you want to quit the vi program without saving any of the changes you made to your file, you can type in command mode:
:q!
To search backward from your cursor in your vi document in command mode, you can type __ followed by the pattern to search for.
?
The path testdir/file.txt is:
A relative path
Assuming at least one file matching the pattern is in the current directory, the command echo ???a will display:
All of the files in the current directory that have four characters in the file name with the last character being an "a" character.
Chapter 10
Chapter 10
Chapter 2
Chapter 2
Chapter 3
Chapter 3
Chapter 4
Chapter 4
Chapter 5
Chapter 5
Chapter 6
Chapter 6
Chapter 7
Chapter 7
Chapter 8
Chapter 8
Chapter 9
Chapter 9
The /usr/local/bin directory contains:
Commands that have been compiled from local sources
The mkdir command cannot be used to:
Delete a directory
What would typing 4dh do in vi command mode?
Delete the previous four characters
The head -n -1 readme.txt command will:
Display all but the last line of readme.txt
The command man 5 passwd will:
Display the man page in Section 5 for passwd.
In a command pipeline, the output of one command is sent to another command as output.
False
The ls command can list the contents of only one directory at a time.
False
The ls-l command output will not include:
File contents
If you are in the vi command mode and want to add a new line before your cursor, you would type:
O
Environment variables are:
Passed into other shells and commands
What does the vertical bar | character do in a regular expression?
Separates alternative patterns that can be matches
To process a script file in the current context, you execute:(choose two)
Source . (period)
The PATH environment variable is used for:
Specifying directories to search for executable files
Which of the following are glob characters?(choose three)
The asterisk * character The question mark ? character The square brackets [] notation
By default, using the touch command on an existing file will update the file's _____.
Timestamp
A pair of single quotes ' will prevent the shell from interpreting any special character.
True
You can combine glob characters in a single pattern, for example: a??*[0-9].
True
The FHS sets which standard?
Which directories should be used to hold specific files
What is the reason you would use the grep command with a quiet -q option?
You do not want to write anything to standard output
Which two characters match a single character from a set of specified characters?
[] (brackets)
To go to the beginning of a line in the vi command mode, you press:
^ (carrot)
Which of the following characters can be used to negate (indicate not matching the following characters), when placed as the first of a set of characters enclosed in square brackets [ ] ?(choose two)
^ (carrot) ! (exclamation point)
The regular expression a? is equivalent to:
a{0,1}
The regular expression a* is equivalent to:
a{0,}
If you want to see the entire contents of a text file, you can use the _____ command:
cat
If you want to extract fields from a file, you can use:
cut
Which character at the beginning of a long listing indicates a directory?
d
Which command will send text to the terminal display:
echo
Which of these commands would return the files /etc/game.conf, /etc/file.conf and /etc/snap.conf(choose two)
echo /etc/????.*f ls /etc/????.????
Which of the following commands will take the standard error of the echo command cmd1 and put it into the /tmp/output.txt file:
echo 2> /tmp/output.txt
Which of the following will match files that have the string hello somewhere in the file name?
echo hello
To use extended regular expressions, you can use:(choose two)
egrep grep -E
The _____ command will search for files by searching the filesystem in real-time.
find
To see a list of commands that are available while viewing a man page, you can type the __ character.
h
If you are in the vi command mode and want to begin inserting text before your cursor, you can type:
i
Select the function that the tr command cannot perform:
insert characters
If you want to move up a line in vi command mode, you can press the Up Arrow Key ↑ or:
k
Which of the following commands can be used to scroll through a text file?
less
To perform a long listing to show file details, use which of the following commands:
ls -l
Which of the following are valid command lines?
ls /etc -l ls -l /etc
Which command can be used to send the output of a command to both stdout and a file:
ls | tee /tmp/output.txt
If you are in vi command mode and want to add a new line after your cursor, you can type:
o
This command displays binary files in a variety of representations:
od
Which command will merge two files together line by line?
paste
The ______ command will display your current working directory.
pwd
To display your current location within the filesystem, you can type:
pwd
Environment variables cannot be created by which command?
set
If you want to break apart a large file into smaller files, you can use:
split
Many commands that read text files will also read from this stream:
stdin
This stream is the output of a command operating normally:
stdout
The file command uses _____ to determine file types.
the magic file
The _____ command will tell you if a command exists as a built-in command, function, alias or a command located within the PATH variable.
type
Which two symbols can effectively send stdin to a command?(choose two)
| ?
Which file can you place in your home directory to be executed when you log off the system?
~/.bash_logout