Davechild - Linux Command Line PDF
Davechild - Linux Command Line PDF
Bash Commands
uname -a
Bash Variables
Show system and kernel
env
Show environment
echo $NAME
filesystems
export NAME=value
$PATH
$HOME
Home directory
$SHELL
Current shell
date
uptime
Show uptime
whoami
man command
cmd1 ; cmd2
variables
Show distribution
Show mounted
Command Lists
command
IO Redirection
Bash Shortcuts
CTRL-c
CTRL-z
Sleep program
CTRL-a
Go to start of line
CTRL-e
Go to end of line
CTRL-u
CTRL-k
CTRL-r
Search history
!!
!abc
!abc:p
!$
ALT-.
!*
^abc^123
Directory Operations
pwd
mkdir dir
cd dir
cd ..
Go up a directory
ls
List files
ls Options
-a
-R
Recursive list
-r
Reverse order
-t
-S
-l
-1
-m
Comma-separated output
-Q
Quoted output
Search Files
grep pattern files
grep -i
Case insensitive
search
grep -r
Recursive search
grep -v
Inverted search
grep -o
Sponsored by Readability-Score.com
cheatography.com/davechild/
www.addedbytes.com
Page 1 of 2.
https://readability-score.com
Process Management
ps
CTRL-A
name in dir
top
kill pid
pkill name
killall name
whereis command
beginning name
Nano Shortcuts
Files
File Operations
Ctrl-R
Read file
touch file1
Ctrl-O
Save file
Ctrl-X
Close file
Create file1
CTRL-A "
Show current instances of terminals.
CTRL-A A
ALT-A
CTRL-K
http://www.gnu.org/software/screen/
CTRL-U
Paste text
File Permissions
Navigate File
file file1
Get type of file1
cp file1 file2
Copy file1 to file2
mv file1 file2
Move file1 to file2
rm file1
Delete file1
head file1
Show first 10 lines of file1
ALT-/
End of file
CTRL-A
Beginning of line
CTRL-E
End of line
CTRL-C
CTRL-_
Go to line number
CTRL-W
Find
ALT-W
Find next
CTRL-\
group
Screen Shortcuts
screen
Start a screen session.
Watch a Command
Search File
http://www.nano-editor.org/docs.php
tail file1
screen -r
below.
4
read (r)
write (w)
execute (x)
Sponsored by Readability-Score.com
cheatography.com/davechild/
www.addedbytes.com
Page 2 of 2.
https://readability-score.com