Linux Chapter 3
Describe three options you can use with the ls command.
-a Lists all files, including hidden files -F Appends a special character to each filename to represent the file type, such as * for an executable file and / for a subdirectory -h Stands for "human-readable" format, which shows file sizes in megabytes or gigabytes, for example, instead of in bytes -i Displays the inode number (discussed later in "Creating Links") for each file -l Changes the display from a column format to a long list -R Stands for recursive, meaning the ls command is repeated for all subdirectories --help Lists all options available with a command
Describe three man page sections.
1 Executable programs or shell commands man ls, man pwd 2 System calls, which are system requests that programs make to the kernel man kill, man read 3 Library calls (to access functions in program libraries) man xcrypt, man stdin 4 Special files, such as the floppy disk, that are usually found in /dev man fd, man tty 5 File formats and conventions man passwd, man hosts 6 Games man tetravex, man AisleRiot 7 Macro packages and conventions man man (7), man gruff (7) 8 System administration commands man yast, man suseconfig
Command Completion
A BASH shell feature that finishes a command for you after you enter the first few characters; it's enabled by pressing the Tab key.
Wildcard
A character used in searches to specify certain conditions.
Inode
A data structure that stores information about a file, such as the inode number, file permissions, file owner, and so on; the file's actual data and name aren't stored in the inode.
Shareable File
A file that can be stored on one machine and used by multiple users on other machines.
Unshareable File
A file that can be used only on the local machine.
Inode Table
A list of inodes for all files on a Linux partition; entries in this table point to where files' actual data is stored. See also inode.
Filesystem Hierarchy Standard (FHS)
A standard specifying requirements and guidelines for file and directory placement in UNIX-like operating systems.
Inode Number
A unique identification for an inode that references an entry in the inode table. See also inode.
Home Directory
A user's default directory on the file system.
Explain the difference between an inode table, an inode, and an inode number.
An inode table lists all inodes on a Linux partition. An inode is a data structure that stores information about a file, such as size and inode number; it doesn't contain the actual data or the filename. An inode number references an entry in the inode table.
Command-line Prompt
An interface that enables users to interact with the OS by typing commands, options, and arguments.
The -l option effects the ls command by: a. Changing the format to a long list b. Listing all files and directories c. Listing only files d. Listing inode numbers
Changing the format to a long list
How does the -s option affect the ln command?
Creates a symbolic link
How does the -i option affect the ls command?
Displays the inode number
Man (manual) Pages
Documentation files that describe Linux shell commands, executable programs, system calls, special files, and so forth.
The cd/home/user command uses the relative method. True or False?
False
There can be multiple root directories in Linux. True or False?
False
Which of the following information is displayed after issuing the ls -l command? (Choose all that apply.) a. File permissions b. Parent directory c. File type d. Contents of subdirectories
File permissions File type
Variable Files
Files that can change on their own.
Static Files
Files that don't change on their own.
Hard Links
Files that point to data on the hard disk and share the same inode number.
Explain the difference between hard links and symbolic links.
Hard links are files on the same partition that point to data on the hard drive. All hard links with the same inode number on the same disk partition point to the same data. Symbolic links are special types of files that point to other files, which can be on different partitions or even different computers. Unlike hard links, they don't share the same inode number
Learning to navigate the Linux directory structure at the command line is a useful skill for server administrators because most servers are installed without a GUI.
In Linux, there's only one root directory, and all files and subdirectories are placed under it in a hierarchical structure.
Command-line Argument
Information entered after a command to include specific instructions.
Options
Information entered after a command to modify the way it's carried out.
Describe a benefit of the Filesystem Hierarchy Standard (FHS).
Linux users and software developers can find the correct configuration files regardless of the distribution they're using. Another benefit is that Linux software developers can create software that works in all major distributions.
Symbolic Links
Special types of files that point to other files (even on separate partitions or different computers) instead of pointing to data on the hard drive; they don't share the same inode number. See also hard links.
Explain how the -r option affects the rm command.
The -r option removes directories and their contents recursively.
Current Directory
The directory a user is working in.
Relative Path
The directory pathname starting from the current directory.
Absolute Path
The full directory pathname starting from root (/).
The mv command is used to move and rename files, and the cp command is used to create a copy of a file.
The ln command is used to create hard and symbolic links. Hard links point to data on the hard drive, and soft links point to files that can span multiple partitions.
To change the current directory, you can use the absolute method or the relative method. The absolute method always starts with root (/), and the relative method always starts with the current directory.
The ls command lists the contents of a directory. The -l option is used with this command to display a long list of files and subdirectories in the directory.
Nearly all major Linux distributions follow the Filesystem Hierarchy Standard (FHS), which defines the kind of files that should be in each subdirectory of root.
The pwd command displays your current directory, and the cd command changes your current directory.
The mkdir command is used to create directories, and the touch command is used to create empty files and update their timestamps.
The rm command deletes files or directories, and the rmdir command deletes only empty directories.
File System
The way files and directories are stored and organized to make access to data easier.
After entering ls -a, how can you tell which files are hidden? a. Their names are displayed in a different color. b. Their names start with a . (dot). c. Their names start with an uppercase letter. d. Their names end with a . (dot).
Their names start with a . (dot).
Linux includes man pages for finding information on commands and other Linux components.
Wildcards are special characters used to help specify a filename or directory path. The two most common wildcards are * and ?. The * represents zero or more characters, and the ? represents only one character.
After you use the ls command, the following files are displayed: file1 file2 file3 file.a file.b file.c files List the files displayed with each of the following options: a. ls f* b. ls file? c. ls file[a-c] d. ls file[!1-3]
a. ls f*
What command do you use to change to a different directory? a. ln b. cd c. pwd d. ls
cd
What command is used to copy a file? a. rn b. cp c. mv d. Both b and c
cp
What command is used to view the contents of your current directory? a. ln b. cd c. pwd d. ls
ls
What command creates directories? a. rm b. mkdir c. touch d. rmdir
mkdir
What command is used to rename or move a file? a. rn b. cp c. mv d. Both b and c
mv
What command do you use to display your current directory? a. ln b. cd c. pwd d. ls
pwd
What command deletes files and directories? a. rm b. mkdir c. touch d. rmdir
rm
What command deletes empty directories? a. rm b. mkdir c. touch d. rmdir
rmdir
What Linux command can you use to switch users without actually logging off your system?
the su command
What command creates an empty file? a. rm b. mkdir c. touch d. rmdir
touch