Shell and Command Line Basics Flashcards
internal command
command within your shell, part of the shell
external command
stored as separate binaries, started with a sub-process
PATH
environment variable storing a list of directories in which commands can be found
change PATH variable by editing…
shell config file
required to run programs which don’t exist in PATH
complete path of the utility
command completion
type part of a command or filename and press Tab key for completion
- displays result or possible results
history
- record of typed commands
- stored in /bash_history
- up and down arrow keys
historical search
- ctrl+R to begin a reverse search
- ctrl+S is a forward search
- ctrl+G terminate search
movement
- ctrl+A start of line
- ctrl+E end of line
- ctrl+left or right arrows move by one word
delete text
- ctrl+D or delete key deletes character under cursor
- backspace deletes character to the left of cursor
- ctrl+K deletes all text from cursor to end of line
- ctrl+X, backspace deletes all text from cursor to start of line
invoke an editor
- ctrl-X, ctrl+E
- launches an editor defined by FCEDIT or EDITOR environment variables
main global config files for shell
- ~/.bashrc
- ~/.profile
~ directory
your home directory
environment variables
value references which can be shared by different programs within an environment
set environment variable
- know name of env var
- use assignment operator (=)
- export variable
(i. e. export NNTPSERVER=new.abigisp.com)
$ identifier
identifies a variable (i.e. echo $PATH)
command env
view entire environment of variables
command unset
- remove environment variable
- syntax: unset [variableName]
command man
- text-based system known as man, for manual
- syntax: man [programName]
less pager
- displays information
- spacebar to move forward by a page
- esc followed by V to move back a page
- arrow keys move up or down line by line
- / key to search for text
- q key to exit
command info
- info pages which allow hypertext format
- syntax: info [program]
stream
data entity that can be manipulated
standard input stream
stdin input typically from a keyboard
standard output stream
stdout, normally displayed on screen
standard error stream
- stderr, carry high-priority info such as error messages
- typically sent to stdout
> redirection
creates a new file containing stdout, overwriting if necessary
> > redirection
appends stdout to existing file, creating if necessary
2> redirection
creates a new file containing stderr, overwriting if necessary