Command Line Flashcards
Command
- Sequence of characters in a line which ends by pressing enter and is subsequently evaluated by the shell
- What to do
Options command line parameter
- Start with a dash
- also called switches
- How to do it
Argument command line parameter
- No leading dash
- Often names of files
- What to do it with
Typical command line format
- Command, Option, Argument
- can vary depending on the program
Shell Script
File containing a series of commands
Variables
- Areas of memory that can be used to store information and are referred to by a name
- “$name” create variable
- name=david set value of variable
- by convention all upercase
Variable requirements
- Start with a letter
- No spaces
- No punctuation marks
printenv
Displays environmental variables
Meta character
Quoting
- Act of protecting shell meta-characters from being treated specially by the shell
- “” not treated as wildcard when quoted (or ‘’ or *
- Prevents shell from acting on and expanding the meta-characters
- ”” ‘’ \
~
Represents home directory
ls
- List contents of current directory
- -ls list with addtional detail
Manual (Man) Pages
- A set of pages explaining every command available on the system
- $man command you want to use
- -k (executes key word search of man pages)
Info Pages
- Like MAN pages but more detailed
- Divided into different nodes or pages and works like a web browser
- p previous, n next, q exit
dmesg command
Shows system boot time messages.
CTRL + SHIFT + C
Copy highlighted text while working in the command line
$0, $1, $2, ect
- Predefined variables
- $0 refers to current script
- $1 refers to fist line, $2 the second, and so on
\d
Add the date to the prompt in the shell
which command
Search for executable programs or scripts located in the PATH variable
whereis command
Locate the executable, source, and manual page files for any command
variable_name=$(command) or
variable_name=’command’
Save the out put of a command into a variable
apropos command
searches manual page names and descriptions for a user-supplied keyword