Chapter 7 Flashcards
Blank are files that control how the computer operates
System files
Name the 7 types of system files
1) System startup scripts that launch servers and other important daemons
2) Program files - both binary files and scripts
3) Program support files - such as icons and fonts
4) Configuration files that define how the system works
5) Configuration files for most services and other daemons
6) Data storage for system programs
7) System log files
Blank, such as user data files and program binary files, may be reasonably shared between computers
Shareable files
Blank files contain system specific information, such as configuration files.
Unshareable
What system provides some standardization in the layout of directories across multiple user accounts
Filesystem Hierarchy Standard (FHS)
Blank files don’t normally change unless through direct intervention by a system administrator
Static
Users, automated scripts, and servers are examples of blank files.
Variable
Static or Variable? /usr
Static
Static or Variable? /home
Variable
Static or Variable? /etc
static
Static or Variable? /root
static
Static or Variable? /var/mail
variable
Static or Variable? /var/run
variable
Static or Variable? /etc
static
Static or Variable? /var/lock
variable
The root directory. All files appear in this directory or subdirectories of it
/
The directory that holds system configuration files
/etc
The directory that holds important boot files, such as the Linux kernel
/boot
The directory that holds program files that are critical for normal operation and users may run
/bin
The directory that holds program files that are critical for normal operation and users may seldom run
/sbin
The directory that holds libraries
/lib
The directory that holds programs and data used in normal system operation but that are critical for a bare bones boot of the system
/usr
The directory that holds users’ home directory
/home
The directory that is the root’s users’ home directory
/root
The directory that holds miscellaneous transient files, such as log files and print spool files
/var
The directory that holds temporary files, often including temporary files created by user programs
/tmp
The directory that is the traditional mount point for removable media; typically split into subdirectories for each mounted filesystem
/mnt
The directory that is the new mount point for removable media
/media
The directory that holds device files, which provide low-level access to hardware
/dev
The directory that has information about the running system
/run
The blank directory holds most system configuration files
/etc
Program files that exist in /sbin, /bin, /usr/sbin and /usr/bin are blank
executable directories
Blank are collections of programming functions that can be useful to many programs. They’re stored in separate files to save disk space and RAM when programs run
Library directories
To manipulate files, it’s helpful to know what they are. The blank command provides you with this information
ls
Give both the long form and short form ls option that will display dot(hidden) files
–all -a
Give the long form option of ls that produces a color coding listing that differentiates directories and other special files by displaying them in different colors
–color
Give both the long form and short form ls option that changes the behavior of ls to only list directory names
–directory -d
Give both the short form ls option that produces a long listing that includes information such as the file’s permission string, owner, group, etc
-l
Give both the long form and short form ls option that appends an indicator code to the end of each name so that you know what type of file it is
–file-type -F
Give both the long form and short form ls option that causes ls to display directory contents recursively up the directory ladder(if you are in a subdirectory)
–recursive -r
The blank command changes the current directory in which you are working
cd
If you need to know the complete path of your current location, use what command
pwd
When pointing to files and directories in commands, you can refer to them in what three ways
Absolute references
Home Directory references
Relative references
Which reference type always begins with a /
Absolute reference
The blank character refers to the user’s home directory and is used in home directory reference
tilde ~
Relative reference can mean typing file name that is in the directory you are working in or using the special hidden reference (blank)
..
In order to create files, you can use the blank command followed by the name of the file that you want to create
touch
What happens if you pass the name of an existing file with the touch command?
The file access and modification time stamps are updated
The blank or blank option with touch tells the system to not create a new file if one doesn’t already exist
-c –no-create
You can use blank or blank to set the date of a touch file to a specified value
-d –date=string
If you’re working in a text-mode shell, blank command copies a file
cp
What is the command to copy orig.txt to new.txt in the current directory?
cp orig.txt new.txt
What is the command to copy orig.txt to the otherdir directory?
cp orig.txt /otherdir
What is the command to copy orig.txt to the otherdir directory and rename the copy new.txt?
cp orig.txt /otherdir /new.txt
With the cp command, what option(s) forces the system to overwrite any existing files without prompting?
-f or –force
With the cp command, what option(s) causes cp to ask you before overwriting any existing files?
-i or –interactive
With the cp command, what option(s) copies the entire directory, including its subdirectories.
-R or –recursive
With the cp command, what option(s) is similar to recursive copy, but preserves ownership and copies links as is?
-a or –archive
With the cp command, what option(s) tells cp to copy the file only if the original is newer than the target or if the target doesn’t exist.
-u or –update
In the text-mode shell, you use the blank command to move and rename a file.
mv
With the cp command, what option(s) preserves ownership and permissions, if possible?
-p or –preserve
What happens to the original file when you use the mv command?
It’s deleted
What three options to the mv command don’t work, but work for the cp command?
–preserve –archive –recursive
What command creates links to files?
ln
What is the syntax for using the ln command?
ln origname linkname
A blank is a file that refers to another file by name and using the link redirects to the original file
Symbolic (or soft) link
What is the syntax for creating a soft link?
ln -s origname linkname
The blank command deletes files in a text mode shell
rm
How can you delete an entire directory tree?
rm -r directory
What option for the rm command prompts you before deleting each file?
-i
What option for the rm command overrides the prompt before deleting default?
-f
A blank is a symbol that stands in for other characters and is sometimes called globbing
wildcard
When using wildcards, what symbol stands in for a single character?
? question mark
When using wildcards, what symbol stands in for any character or set of characters?
- asterisk
Characters enclosed in what symbol normally match any character within the set
square brackets []
Linux’s native filesystems are blank, which means the filenames differ only in case are distinct files.
case-sensitive
You can use the blank command to create a directory
mkdir
When using the mkdir command, you can use the blank option(s) to specify the permissions according to the octal number that you pass
-m or –mode
When using the mkdir command, you can use the blank option(s) to create a necessary parent directory when one doesn’t exist to create the passed directory and parent directory
-p or –parents
When using a text-mode shell, what command deletes directories?
rmdir
What must be true to use the rmdir command on a directory?
The directory has to be empty
What option can you use on the rmdir command to prevent the system from giving you an error message when you try to delete a non-empty directory?
–ignore-fail-on-non-empty
What option(s) can you use on the rmdir command to cause rmdir to delete an entire directory tree?
-p or –parents
What is the syntax for deleting a directory AND any subdirectory that it might contain?
rm -r directoryname
You can use what command to update a directory’s timestamp, but you cannot use it to create a new directory
touch
You can use what command to copy a directory, however you must use what options to copy the directory and all its contents?
cp
-r, -R, –recursive, -a, or –archive
What command can you use to move a directory?
mv
What command can you use to create links to directories?
ln
True or False: Linux does not support hard links to directories.
True
Which of the following commands would you use to rename newfile.txt to afile.txt?
A. mv newfile.txt afile.txt
B. cp newfile.txt afile.txt
C. ln newfile.text afile.txt
D. rn newfile.txt afile.txt
E. touch newfile.txt afile.txt
A
You want to copy a directory, MyFiles, to a USB flash drive that uses the FAT filesystem.
The contents of MyFiles are as follows:
contract.odt
outline.pdf
outline.PDF
The USB drive is mounted at /media/usb, and so you type cp -a MyFiles/media/usb. What problem will occur when you attempt to copy these files?
A. The command will fail because it tries to create links.
B. The MyFiles directory will be copied, but none of its files will be copied.
C. One file will be missing on the USB flash drive.
D. One file’s name will be changed during the copy
E. Everything will be fine. The copy will work correctly.
C
You type mkdir one/two/three and receive an error message that reads in part No Such File or directory. What can you do to overcome this problem? Select all that apply
A. Add the –parents parameter to the mkdir command
B. Issue three separate commands mkdir one, mkdir one/two and mkdir one/two/three
C. Type touch mkdir to be sure the bin/mkdir file exists
D. Type rmdir one to clear away the interfering base of the desired new directory tree
E. Type rm -r one to clear away the entire interfering tree
A, B
True or False: You can create a symbolic link from one low-level filesystem to another
True
True or False: You can easily damage your Linux installation by typing the rm command when you log in to your regular account?
False
True or False: You can set a directory’s timestamp with the touch command
True
You want to copy a file (origfile.txt) to the backups directory, but if a file called origfile.txt exists in the backup directory, you want to go ahead with the copy only if the file in the source location is newer than the one in the backups. The command to do this is cp blank origfile.txt /backups/.
-u
You’ve typed rmdir junk to delete the junk directory, but this command has failed because junk contains word processing files. A command that will work is blank.
rm -r junk
The blank wildcard matches any one symbol in a filename.
?
What directory primarily contains system configuration files?
/etc