Chapter 2 - Access the Command Line Flashcards
Shell
The interpreter that executes commands that are typed as string
Prompt
The visual cue that indicates that an interactive shell is waiting for the user to type a command
Command
The name of a program to run
Option
The part of the command line that adjusts the behavior of a command
Argument
The part of the command line that specifies the target that the command should operate on
Physical Console
The hardware display & keyboard to interact w/ a system
Virtual Console
One of multiple logical consoles that can each support an independent login session
Terminal
An interface that provides a display for output & a keyboard for input to a shell session
“tail -n 5 /var/log/messages”
Displays the last five lines of the /var/log/messages file
Semicolon ;
Separates commands on the same line
“passwd”
Used to change a user’s password
“file”
Displays the file type
Pressing Tab
Completes commands, file names, & options
“!number”
Re-executes a specific command in the history list
Ctrl+A
Jumps to the beginning of the command line
“history”
Displays the list of previously executed commands
Esc+
Copies the last argument or previous commands
Contains persistent, system-specific configuration data
/etc
is the top of the system’s file-system hierarchy
/
contains user home directories
/home
contains files to boot the system
/boot
contains system files to access hardware
/dev
is the administrative superuser’s home directory
/root
contains regular commands & utilities
/usr/bin
contains non-persistent process runtime data
/run
contains installed software programs & libraries
/usr
a world-writable space for temporary files
/tmp
system-specific variable data should persist b/t boots
/var
displays the full path name of the current working directory for that shell
“pwd”
lists directory contents for the specified directory, or, if no directory is given, for the current working directory
“ls”
change your shell’s current working directory
“cd”
changes to the previous directory, where the user was previously to the current directory
“cd -“
uses the hidden directory to move up one level to the parent directory w/o needing to know the exact parent name
“cd ..”
specifies the current directory on commands where the current location is either the source or destination argument
“cd .”
displayed when your current working directory is your home directory
”~”
updates the time stamp of a file to the current date & time w/o otherwise modifying it
“touch”
long listing format
“ls -l”
all files, including hidden files
ls -a”
recursive, to include the contents of all subdirectories
“ls -R”
refers to the current directory
”.”
refers to the parent directory
”..”
Which command returns to your current home directory, assuming that the current working directory is /tmp & your home directory is /home/user?
“cd”
Which command displays the absolute path name of the current location?
“pwd”
Which command returns you to the working directory before the current working directory?
“cd -“
Which command changes the working directory up two levels from the current location?
“cd ../..”
Which command lists files in the current location, with a long format, & including hidden files?
“ls -al”
Which command creates an empty file called “helloworld.py” in the “user” home directory, assuming that your current directory is “/home”?
“touch ~/helloworld.py”
Which command changes the working directory to the parent of the current location?
“cd ..”
Which command changes the working directory to “/tmp” if the current working directory is ‘/home/student?
“cd ../../temp”
What shows subdirectories?
”/”
Displays the full path name of the current working directory for that shell
o Helps to determine the syntax to reach files by using relative path names
“pwd”
lists directory contents for the specified directory, or, if no directory is given, for the current working directory
“ls”
change your shell’s current working directory
“cd”
changes to the previous directory, where the user was previously to the current directory
“cd -“
uses the hidden directory to move up one level to the parent directory w/o needing to know the exact parent name
“cd ..”
specifies the current directory on commands where the current location is either the source or destination argument
“cd .”
displayed when your current working directory is your home directory
”~”
updates the time stamp of a file to the current date & time w/o otherwise modifying it
“touch”
Long listing format
“ls -l”
All files, including hidden files
“ls -a”
recursive, to include the contents of all subdirectories
“ls -R”
refers to the current directory
One dot (.)
refers to the parent directory
Two dots (..)
creates one or more directories or subdirectories
“mkdir”
creates any missing parent directories for the requested destination
“mkdir -p” (parent)
copies a file, & creates a file either in the current directory or in a different specified directory
“cp”
copies directories & their contents
“cp -r”
moves files from one location to another
“mv”
displays a detailed output of the command operations
“mv -v”
removes files, does NOT remove directories
“rm”
enables the “rm” command to remove directories & their contents
“rm -r”
interactively prompt for confirmation before deleting
“rm -i”
determines whether 2 files are hard linked
“ls -i”
can determine whether a file has multiple hard links; lists the inode number
“ls -i”
lists the directories that are on different file systems
“df”
creates a symbolic link, aka “soft link”
“ln -s”
indicates that the file is a symbolic link & not a regular file
“l”
updates current working directory by using the name of the symbolic link rather than the name of the actual directory
“cd”
Which command returns to your current home directory, assuming that the current working directory is /tmp & your home directory is /home/user?
“cd”
Which command displays the absolute path name of the current location
“pwd”
Which command returns you to the working directory before the current working directory?
“cd -“
Which command changes the working directory up two levels from the current location?
“cd ../..”
Which command lists files in the current location, with a long format, & including hidden files?
“ls -al”
Which command creates an empty file called “helloworld.py” in the “user” home directory, assuming that your current directory is “/home”?
“touch ~/helloworld.py
Which command changes the working directory to the parent of the current location?
“cd ..”
Which command changes the working directory to “/tmp” if the current working directory is ‘/home/student?
“cd ../../temp”
Which pattern matches only file names that end with “b”?
“*b”
Which pattern matches only file names that begin with “b”?
“b*”
Which pattern matches only file names where the first character is not “b”?
“[!b]*”
Which pattern matches all file names that contain a “b”?
“b”
Which pattern matches only file names that contain a number?
“[[:digit:]]”
Which pattern matches only file names that begin w/ an uppercase letter?
“[[:upper:]]*”
Which pattern matches only file names w/ at least 3 characters?
“???*”
can nest command expansions inside each other
“$(command)”
stops all shell expansion
Single quotation mark (‘)
stops most shell expansion
Double quotation mark (“)