Linux Final
You're writing a script that should accept two arguments, a username and a year, specified in that order on the command line. What variable would you use to access the year?
$2 being the second argument
The Bash logical-and operator is ____.
&&
Which of the following options to chown changes the ownership of all the subdirectories of any specified directories, rather than just the files or directories that are explicitly passed to it?
-R or --recursive
You can type Xorg ________, as root, to have X create a default configuration file that you can then modify.
-configure
The user arnold is currently logged in. Despite this fact, you want to delete his account without first logging him off. You don't want to delete arnold's files. To accomplish this goal, you type userdel ___ arnold.
-f or --force
To refer to the file afile.txt in the directory one level above the current one, you would type ___afile.txt
../
The file that associates usernames with UID numbers in Linux is ___________. (Provide the complete path to the file.)
/etc/passwd
In what file are you likely to find the following lines? domain pangaea.edu nameserver 192.168.1.2 nameserver 10.78.102.1
/etc/resolv.conf
To append a program's standard error to an existing file without deleting its contents, you should use the ____ redirection operator.
2>>
The character that separates fields on each line of /etc/passwd is ___.
:
You're working in Vi and, after having saved your current file, you want to load a new one. You can do so by typing ____ newfile.txt from command mode.
:e
When assigning a value to a variable in a Bash script, you separate the variable from its value with the ____ character.
=
What symbol do you place after a command to run the program in the background?
An ampersand (&), placed after a command typed in Bash, causes the command to run in the background,
True or False: As a general rule, you should employ extra care when running programs as root.
Answer: True
What term refers to the worldwide system of servers that translates between IP addresses and hostnames?
Domain Name System (DNS)
The _____ filesystem is very old but is supported by almost every OS, making it a good choice for interoperability.
FAT
True or False: Linux stores information on its groups in the /etc/groups file.
False
True or False: whoami provides more information than id.
False
True or false: All Linux Web browsers are GUI programs
False
True or false: All user accounts are necessarily defined in /etc/passwd and /etc/shadow.
False
True or false: If you want to create a link to a directory, you must use a hard link.
False
True or false: It's impossible to run a Bash script if it hasn't had an executable bit set on its file.
False
True or false: The -n option to traceroute causes it to display hostnames rather than IP addresses.
False
True or false: The /etc/group file supports linking each user to a maximum of one group.
False
True or false: The /var/log/messages file always holds general-purpose log entries.
False
True or false: The Secure Shell program is a command interpreter that keeps no history of its actions for others to discover, hence its name.
False
True or false: The gzip program generally produces more compact compressed files than does the bzip2 program.
False
True or false: The host program has been deprecated.
False
True or false: To run a GUI program in Linux, you must launch it from a desktop environment's menus.
False
True or false: To save a text file in Vi, you should press Ctrl+S.
False
True or false: Typing ls *.* at a Bash prompt is guaranteed to show you all the files in the current directory.
False
True or false: User ID numbers are linked to usernames in a way that ensures the mapping is identical on all computers.
False
True or false: You can configure your power supply by accessing the /dev/power device file.
False
True or false: dhcpd is a common DHCP client for Linux.
False
True or false: Users should be logged in when you change their UID numbers with usermod.
False users should be logged out before you attempt to change their UID numbers.
Which of the following two office suites are most closely related to one another?
LibreOffice is derived from OpenOffice.org
Which of the following are risks you take when you browse the Web as an ordinary user on a properly-configured Linux system? (Select all that apply.)
Most Web sites are unencrypted, so data transferred from the site and your computer, or vice-versa, can be intercepted Some Web sites deliver mini-programs that run on your computer, and if such a site delivers a malicious program, it could do just about anything, including steal your personal data files
What does the permission string -rwxrwx--- mean?
Only the group and owner can read, write, and execute
The _____ library provides drivers to control scanners. (Provide the acronym for the library's name.
SANE
Postfix is a server that implements the ______ protocol. (Provide the protocol's acronym.)
SMTP
You want to create a link from your home directory on your hard disk to a directory on a CD-ROM drive. Which of the following types of links might you use?
Symbolic links can point across filesystems, so creating a symbolic link from one filesystem (in which your home directory resides) to another (on the CD-ROM) isn't a problem
You want to create a new system account for a server program you're installing. What option can you pass to useradd when creating the account to ensure that it's created as a system account?
The --system (or -r) option to useradd creates a system account, which has no home directory and uses a low user ID number.
Which option to zip can you use to encode symbolic links as such rather than including the linked-to file?
The -i option does as the question specifies
You want to create a directory called ~/Documents/papers, but you're not sure that the ~/Documents directory exists. What command can you type to create the desired directory and its parent directory if it doesn't already exist?
The -p option to mkdir creates parent directories if they don't already exist
Which options to find can you use to locate files owned by a particular user? (Select all that apply.)
The -uid option to find locates files owned by a user with the specified user ID (UID) number, and the -user option locates files based on the user's username
Which of the following files defines Linux groups?
The /etc/group file defines groups on a Linux system
Which of the following is an inappropriate choice for a filesystem to hold the majority of a Linux installation?
The Hierarchical File System (HFS) was used by Mac OS prior to Mac OS X. It doesn't support features required by Linux in its main filesystem
What is the purpose of the system account with a UID of 0?
The UID 0 is reserved for the root user.
You want to run the command cat /etc/shadow as root, but your logged in as an ordinary user. Which of the following commands will do the job, assuming that the system is configured to give you root access via the appropriate command?
The command sudo cat /etc/shadow will give the ordinary user access for the command to run as root.
Which of the following text editors runs as a text-mode program when launched in text mode but also provides a GUI version for use in a GUI environment?
The emacs editor
Which of the following programs produces a summary of the memory status of your computer, including the total memory available, the amount used, and the amount that's unused?
The free command produces the information specified
Which character begins a comment in many common configuration files, such as /etc/fstab?
The hash mark (#) identifies comments in many (but not all) configuration files
What program can you use to manually bring up a network interface in Linux?
The ifconfig program
Where does the kernel store its ring buffer logs?
The kernel ring buffer is held in memory
What keystroke deletes a line of text when using nano?
The keystroke for deleting a line of text in nano is Ctrl+K,
You're logged in as root and you type passwd auser to change auser's password. What information will passwd ask you to enter?
The new password and then to retype the new password
Which of the following tools can you use to identify running processes?
The ps and top programs are text-mode commands to identify running programs
You type touch afile.txt in a directory that contains no files. What will be the effect?
The touch command updates a file's time stamps or creates a new empty file if one doesn't already exist. Since the latter case is described by the question, a new file will be created,
Which of the following programs are Linux file managers? (Select all that apply.)
Thunar, Nautilus, Konqueror
You want to copy the contents of the ~/important directory, including all its subdirectories, to /media/usb. What command can you type to accomplish this goal?
To copy an entire directory tree, you must use a recursive copy parameter, such as --recursive, -R, or -r. (An archive copy, as in --archive or -a, will also work.)
True or false: A carat (^) represents the start of a line in regular expressions.
True
True or false: A file with permissions of crw-rw-r-- is a character device file.
True
True or false: Both RPM and Debian packages can specify that they require other packages. The package system will then refuse to install the package unless these dependencies are met or you provide an override option.
True
True or false: By default, useradd copies a set of user configuration files from /etc/skel when creating a new user account.
True
True or false: HTML is an example of a formatted text file format.
True
True or false: KDE is built atop the Qt widget set.
True
True or false: Linux supports two types of text-mode output to the screen, which you can send to separate files or display devices.
True
True or false: Partitioning a disk can enable you to install multiple OSes on one computer.
True
True or false: Pressing the M key in top causes the display to change to sort processes by memory use.
True
True or false: Symbolic links always have permissions of lrwxrwxrwx.
True
True or false: The ps program enables you to view the process table.
True
True or false: Using chmod, you can add world execute permission to a file without modifying any of the file's other permissions.
True
True or false: With most distributions, the contents of optical discs, USB flash drives, and other removable media appear in subdirectories of /media
True
True or false: You can use a recordable optical disc to transfer data from a Linux computer to a Windows computer.
True
True or false: You can use common external commands, such as find and sed, in your Bash scripts.
True
true or false: You can use grep to search for strings in binary files.
True
What keystroke creates a new blank line immediately below the current one, when typed in Vi's command mode?
Typing "o" in command mode causes a new line to be created
In pico or nano, you can paste text that you've cut or copied earlier by pressing Ctrl+____.
U
A text encoding method that can use single- or multiple-byte encodings to store text using most human alphabets is known as _________.
Unicode
What option can you pass to groupadd to have it create a group with a GID number of 1027?
You can use the --gid (or -g) option to groupadd to specify the GID number for a new group
The files afile.txt and AFile.TXT can both exist on a Linux filesystem because these filesystems are ____________.
case-sensitive
Which of the following programs enable root to set the ownership of files? (Select all that apply.)
chmod chown
The command _______ :users somefile.txt changes the group affiliation of somefile.txt to users.
chown
The /proc/______ pseudo-file holds data on your CPU, such as its model name and clock speed.
cpuinfo
Programs that can look up DNS information include host, nslookup, and _____.
dig
What Bash scripting keyword terminates a case statement?
esac
You're writing a script that will be called by other scripts. You want to signal abnormal termination of your script by passing a value of 8 to the external script under some circumstances. What command can you use in your own script to do this
exit -8 The exit command terminates a script, and you can pass it a value that you want to set as your script's terminating value
A computer's full hostname is franklin.example.org. The machine name portion of this hostname is _________.
franklin
The term _________refers to the use of wildcards in filename specifications.
globbing
You want to delete the oldproj group, so you type ______ oldproj.
groupdel
The first process to be run by the Linux kernel is normally called _______.
init
The character __ identifies a symbolic link in the 10-character symbolic permission string that's associated with a file.
l
A condition in which a program allocates more and more memory but doesn't use the memory it allocates is called a ______ ______ (two words).
memory leak
What type of information can netstat provide? (Select all that apply.)
network interfaces routing table data list of open ports
A(n) _________ environment means that a person cannot deny actions, and the sudo command helps establish this environment.
nonrepudiation
hich of the following programming languages is most often implemented as a compiled language?
only C++ is commonly implemented as a compiled language
When should you use the root account?
only when you need that power to perform administrative tasks,
An attempt to acquire sensitive data directly from victims by posing as a trusted Web site or authority is known as ____.
phishing
You want to test connectivity to tranquility.luna.edu by sending 11 packets to see how many return. To do this, you can type __________ tranquility.luna.edu.
ping -c 11
What command can you use to retrieve user input into a variable in a Bash script?
read
An Internet site that hosts software that you can install with yum, APT, or a similar tool is known as a __________.
repository
You type the following command and see the resulting output: $ ls -l test -rwxr-xr-x 2 rod users 111 Apr 13 13:48 test What is the meaning of the digit 2 immediately prior to the username (rod)?
represents the number of filenames that point to the file—in other words, the number of hard links to the file
UIDs below 500 or 1000 (depending on the distribution) are reserved for use by __________ accounts.
system
To display the last few lines of a text file, you would type _____ afile.txt.
tail
A _______ is a GUI program in which text-mode programs (including shells) run.
terminal
Where do most drivers exist on a Linux system?
the Linux kernel,
Which of the following pieces of information on user accounts is not normally stored in the /etc/passwd file on modern Linux distributions?
the encrypted password is stored in /etc/shadow
Which of the following is not a Linux command shell program?
the login program handles text-mode logins, but it isn't a shell program,
Default permissions are determined by the _____
umask
To learn who is currently logged into the computer and what programs they're currently running, you can type _____.
w
You can use the ____ command to count the characters, words, and lines in a text file.
wc
A _____ loop executes for as long as its condition is true.
while
Spaces and tabs are examples of ________, which separate elements in many configuration files.
whitespace
You can type _____ to learn your current username and nothing more?
whoami
You use the ___ character to separate two strings, either of which should match, in an extended regular expression.
| (pipe)
The string _______, located at the start of the file, identifies a script as a Bash script.
#!/bin/bash
A symbol found in the root shell prompt by default is __.
#
To obtain a color-coded file listing, if your distribution doesn't produce one by default, you would type ls _____.
--color
You want to copy a set of files but be prompted before cp overwrites any existing files. You would use the ___ option to cp to accomplish this goal.
--interactive or -i
The _________ option to tar causes it to back up only the specified low-level filesystem; if another filesystem is mounted within the directory you say to back up, those files will be ignored.
--one-file-system
The programming language that provides a direct one-to-one correspondence between human-understandable words and machine-understandable numbers is ________ language
assembly