Basic Linux Commands Flashcards
http://www.cheatography.com/davechild/cheat-sheets/linux-command-line/
(Bash Commands) uname -a
Show system and kernel
(Bash Commands) head -n1 /etc/issue
Show distribution
(Bash Commands) mount
Show mounted filesystems
(Bash Commands) date
Show system date
(Bash Commands) uptime
Show uptime
(Bash Commands) whoami
Show your username
(Bash Commands) man commandName
Show manual for commandName
(Bash Shortcuts) CTRL-c
Stop current command
(Bash Shortcuts) CTRL-z
Sleep program
(Bash Shortcuts) CTRL-a
Go to start of line
(Bash Shortcuts) CTRL-e
Go to end of line
(Bash Shortcuts) CTRL-u
Cut from start of line
(Bash Shortcuts) CTRL-k
Cut to end of line
(Bash Shortcuts) CTRL-r
Search history
(Bash Shortcuts) !!
Repeat last command
(Bash Shortcuts) !abc
Run last command starting with abc
(Bash Shortcuts) !abc:p
Print last command starting with abc
(Bash Shortcuts) !$
Last argument of previous command
(Bash Shortcuts) ALT-.
Last argument of previous command
(Bash Shortcuts) !*
All arguments of previous command
(Bash Shortcuts) ^abc^123
Run previous command, replacing abc with 123
(Bash Variables) env
Show environment variables
(Bash Variables) echo $NAME
Output value of $NAME variable
(Bash Variables) export NAME=value
Set $NAME to value
(Bash Variables) $PATH
Executable search path
(Bash Variables) $HOME
Home directory
(Bash Variables) $SHELL
Current shell
(IO Redirection) cmd < file
Input of cmd from file
(IO Redirection) cmd1 <(cmd2)
Output of cmd2 as file input to cmd1
(IO Redirection) cmd > file
Standard output (stdout) of cmd to file
(IO Redirection) cmd > /dev/null
Discard stdout of cmd
(IO Redirection) cmd»_space; file
Append stdout to file
(IO Redirection) cmd 2> file
Error output (stderr) of cmd to file
(IO Redirection) cmd 1>&2
stdout to same place as stderr
(IO Redirection) cmd 2>&1
stderr to same place as stdout
(IO Redirection) cmd &> file
Every output of cmd to file
(Pipes) cmd1 | cmd2
stdout of cmd1 to cmd2
(Pipes) cmd1 |& cmd2
stderr of cmd1 to cmd2
(Command Lists) cmd1 ; cmd2
Run cmd1 then cmd2
(Command Lists) cmd1 && cmd2
Run cmd2 if cmd1 is successful
(Command Lists) cmd1 || cmd2
Run cmd2 if cmd1 is not successful
(Command Lists) cmd &
Run cmd in a subshell
(Directory Operations) pwd
Show current directory
(Directory Operations) mkdir directoryName
Make directory directoryName
(Directory Operations) cd directoryName
Change directory to directoryName
(Directory Operations) cd ..
Go up a directory
(Directory Operations) ls
List files
(ls Options) -a
Show all (including hidden)
(ls Options) -R
Recursive list
(ls Options) -r
Reverse order
(ls Options) -t
Sort by last modified
(ls Options) -S
Sort by file size
(ls Options) -l
Long listing format
(ls Options) -1
One file per line
(ls Options) -m
Comma-separated output
(ls Options) -Q
Quoted output
(Search Files) grep pattern files
Search for pattern in files
(Search Files) grep -i
Case insensitive search
(Search Files) grep -r
Recursive search
(Search Files) grep -v
Inverted search
(Search Files) grep -o
Show matched part of file only
(Search Files) find /dir/ -name name*
Find files starting with name in dir
(Search Files) find /dir/ -user name
Find files owned by name in dir
(Search Files) find /dir/ -mmin num
Find files modifed less than num minutes ago in dir
(Search Files) whereis command
Find binary / source / manual for command
(Search Files) locate file
Find file (quick search of system index)
(File Operations) touch file1
Create file1
(File Operations) cat file1 file2
Concatenate files and output
(File Operations) less file1
View and paginate file1
(File Operations) file file1
Get type of file1
(File Operations) cp file1 file2
Copy file1 to file2