Linux practice questions Flashcards

(31 cards)

1
Q

What directly controls hardware and translates the commands from a piece of software into something the hardware can understand and act upon?

A. Finder
B. Explorer
C. Kernel
D. Procmon

A

D. The kernel directly controls hardware, and it translates the commands from a piece of software into something the hardware can understand and act upon. It also manages hardware resources intelligently, such as memory management, for various software and utilities.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the generic name given to the action of protecting shell meta-characters from being treated specially by the shell?

A. Nulling
B. Quoting
C. Slashing
D. Queuing

A

B. Quoting is the generic name given to the action of protecting shell meta-characters from being treated specially by the shell.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which option will cause the echo command NOT to output a trailing newline?

A. -p
B. -n
C. -s
D. -t

A

B. The -n option of the echo command does not output a trailing newline.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which of the following commands will output a list of all of the file names under your home directory and all subdirectories with file names ending with .pdf?

A. search .pdf
B. ls -name -R ‘.pdf’
C. find /home/
.pdf
D. find ~ -name ‘*.pdf’

A

D. To display all of the files with a .pdf extension at the end, the command find ~ -name ‘*.pdf’ is used. This will display all files named *.pdf in the home directory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Your current present working directory is /home/jason/documents/. You just entered cd .. into the command line and then enter pwd. What output do you receive?

A. /home/jason/documents/
B. /home/jason
C. /home
D. /home/jason/documents/..

A

B. The .. is a special directory reference to the parent of the current present working directory. Using cd .. essentially moves the pwd up a single level to /home/jason.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following options must be used to remove a directory and its subdirectories?

A. rmdir -r
B. rm -r
C. rmdir
D. rm -all

A

B. The rm -r option is used to remove a directory and its files/folders recursively.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which of the following is NOT a valid rule in naming a variable?

A. Variable names must start with a letter
B. Variable names must start with numbers
C. Underscores are used instead of embedded spaces
D. Punctuation marks are not allowed

A

B. The name of a variable should only contain letters (a to z or A to Z), numbers ( 0 to 9), or the underscore character ( _). Variables should also always start with a letter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the proper command to use to compress the file filename.txt into the zip archive called myfile.zip?

A. zip myfile.zip filename.txt
B. unzip filename.txt myfile.zip
C. zip filename.txt myfile.zip
D. unzip myfile.zip filename.txt

A

A. The syntax for zipping a file into a zip archive is “zip myfile.zip filename.txt”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What statement is used to get input from the terminal when a shell script is being run?

A. input
B. scan
C. read
D. in

A

C. The read command is used to get input from the terminal when using a shell script.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which option can be used with tail to print the last 10 lines of a file and then keep printing any new lines that may be added continuously?

A. -n
B. -f
C. -x
D. -a

A

B. The -f option is used to “follow” the contents of the file. This lets tail print the last 10 lines of a file (usually a log file) and continue to print out new lines to the screen as they are added to the file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which command is used to make a shell variable known to subsequently executed programs?

A. announce
B. env
C. export
D. transfer

A

C. The command export is used to make a shell variable known to subsequently executed programs. Essentially, the export command creates a globally accessible variable when it is run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What option can be used with cat to display line numbers with the text of a file to the screen?

A. #
B. -x
C. -n
D. -1

A

C. The -n option will show the line numbers next to a file’s contents when displayed to the screen. For example, “cat -n song.txt” will display the contents of the song.txt file with line numbers down the left column of the display.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is one of the most basic features of a shell script?

A. The ability to compile programs
B. The ability to run commands
C. The ability to ask for user input
D. The ability to display command output information

A

B. A shell script is a computer program designed to be run by the shell. Typical operations performed by shell scripts include file manipulation and command execution. The most basic scripts run commands in serial order and do not provide any output back to the screen or seek input from a user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a daemon?

A. A specialized system file
B. A type of virus that destroys system files
C. A program that runs in the background of the system
D. A configuration file

A

C. A daemon is a computer program that runs as a background process rather than under the direct control of an interactive user. Daemons are commonly used for processes that maintain server operations, such as the HTTPD (HTTP daemon) used by Apache to provide web server services to an end-user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which of the following files holds the definition of the local user accounts?

A. c/users
B. /etc/passwd
C. c/id
D. c/home

A

B. /etc/passwd contains the attributes of (i.e., basic information about) each user or account.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which type of link is used to points to another file like a shortcut in Windows or a Macintosh alias?

A. Hard link
B. Symbolic link
C. Sticky link
D. Smooth link

A

B. A symbolic link, also termed a soft link, is a special kind of file that points to another file, much like a shortcut in Windows or a Macintosh alias. Unlike a hard link, a symbolic link does not contain the data in the target file.

17
Q

Which of the following commands is used to show the information about a directory or a symbolic link?

A. ls -d
B. ls -s
C. ln -d
D. ln -s

A

A. ls -d shows information about a directory or symbolic link. This information is usually just its respective path, though.

18
Q

A Linux computer currently has no access to the internet. Which command is used to display and manipulate the information about the network gateway for the system?

A. gateway
B. route
C. ifconfig
D. netstat

A

B. Route command is used to show/manipulate the IP routing table. It is primarily used to set up static routes to specific hosts or networks via an interface.

19
Q

Which of the following is used as a virtual or pseudo filesystem used to interface with the kernel and process?

A. /boot
B. /proc
C. /sys
D. /dev

A

B. The /proc tree originated in System V Unix, where it only gave information about each running process, using a /proc/$PID/stuff scheme. Linux greatly extended that, adding all sorts of information about the running kernel’s status. The intended purpose for the /proc virtual filesystem is to provide an interface into the kernel and its processes.

20
Q

Which of the following directories contain all of the installed kernels on your system and their needed drivers?

A. /boot
B. /proc
C. /sys
D. /dev

A

A. The /boot directory contains the kernel, its associated files, and its needed drivers to boot up the operating system during the startup process.

20
Q

Which of the following options is used with tar to create a new .tar archive file?

A. -c
B. -v
C. -f
D. -n

A

A. The -c option is used to create a new tar file archive.

21
Q

Which of the following programs on a Linux system could you use as a replacement for Microsoft Word?

A. Pages
B. Pico
C. Writer
D. Nano

A

C. Writer is a well-known word processor that is part of the LibreOffice suite. It can be used to replace just about anything that Microsoft Word can do. While vi and nano are text editors, they are not full-featured word processors like Microsoft Word. Pages is a word processor developed by Apple, and it only works on Mac OS X systems.

22
Q

Which option will cause the echo command NOT to output a trailing newline?

A. -p
B. -n
C. -s
D. -t

A

B. The -n option of the echo command does not output a trailing newline.

23
Q

Which of the following commands will output a list of all of the file names under your home directory and all subdirectories with file names ending with .pdf?

A. search .pdf
B. ls -name -R ‘.pdf’
C. find /home/
.pdf
D. find ~ -name ‘*.pdf’

A

D. To display all of the files with a .pdf extension at the end, the command find ~ -name ‘*.pdf’ is used. This will display all files named *.pdf in the home directory.

24
Which of the following options must be used to remove a directory and its subdirectories? A. rmdir -r B. rm -r C. rmdir D. rm -all
B. The rm -r option is used to remove a directory and its files/folders recursively.
25
Which option can be used with tail to print the last 10 lines of a file and then keep printing any new lines that may be added continuously? A. -n B. -f C. -x D. -a
B. The -f option is used to "follow" the contents of the file. This lets tail print the last 10 lines of a file (usually a log file) and continue to print out new lines to the screen as they are added to the file.
26
Which command is used to make a shell variable known to subsequently executed programs? A. announce B. env C. export D. transfer
C. The command export is used to make a shell variable known to subsequently executed programs. Essentially, the export command creates a globally accessible variable when it is run.
27
What is one of the most basic features of a shell script? A. The ability to compile programs B. The ability to run commands C. The ability to ask for user input D. The ability to display command output information
B. A shell script is a computer program designed to be run by the shell. Typical operations performed by shell scripts include file manipulation and command execution. The most basic scripts run commands in serial order and do not provide any output back to the screen or seek input from a user.
28
What is a daemon? A. A specialized system file B. A type of virus that destroys system files C. A program that runs in the background of the system D. A configuration file
C. A daemon is a computer program that runs as a background process rather than under the direct control of an interactive user. Daemons are commonly used for processes that maintain server operations, such as the HTTPD (HTTP daemon) used by Apache to provide web server services to an end-user.
29
Which of the following is used as a virtual or pseudo filesystem to provide a tree of all of the device nodes and drivers in the running kernel? A. /boot B. /proc C. /sys D. /dev
D. The /dev tree contains device nodes, which gives user space access to the device drivers in your OS's running kernel. All POSIX type OSes have a /dev tree.
30
Which of the following files holds the definition of the local user accounts? A. c/users B. /etc/passwd C. c/id D. c/home
B. /etc/passwd contains the attributes of (i.e., basic information about) each user or account.