Davechild - Linux Command Line PDF
Davechild - Linux Command Line PDF
Directory Operations
Nano Shortcuts
uname -a
pwd
Files
Show distribution
mkdir dir
Ctrl-R
Read file
mount
cd dir
Ctrl-O
Save file
date
cd ..
Go up a directory
Ctrl-X
Close file
uptime
Show uptime
ls
List files
whoami
man command
ls Options
ALT-A
CTRL-K
-a
CTRL-U
Paste text
Bash Shortcuts
-R
Recursive list
Navigate File
CTRL-c
-r
Reverse order
ALT-/
End of file
CTRL-z
Sleep program
-t
CTRL-A
Beginning of line
CTRL-a
Go to start of line
-S
CTRL-E
End of line
CTRL-e
Go to end of line
-l
CTRL-C
CTRL-u
-1
CTRL-_
Go to line number
CTRL-k
-m
Comma-separated output
Search File
CTRL-r
Search history
-Q
Quoted output
CTRL-W
Find
!!
ALT-W
Find next
!abc
CTRL-\
!abc:p
!$
ALT-.
!*
^abc^
123
with 123
env
echo $NAME
alue
$PATH
grep pattern
files
$HOME
Home directory
$SHELL
Current shell
http://www.nano-editor.org/docs.php
grep -r
Recursive search
grep -v
Inverted search
grep -o
screen -r
screen -list
Screen Shortcuts
screen
Start a screen session.
name
num
whereis
command
command
locate file
CTRL-A
Activate commands for screen.
CTRL-A c
Create a new instance of terminal.
CTRL-A n
Go to the next instance of terminal.
CTRL-A p
File Operations
IO Redirection
grep -i
name*
Bash Variables
export NAME =v
Search Files
touch file1
Create file1
cat file1 file2
Concatenate files and output
less file1
View and paginate file1
file file1
Get type of file1
cp file1 file2
Copy file1 to file2
mv file1 file2
Move file1 to file2
rm file1
Delete file1
File Permissions
chmod 775 file
Change mode of file to 775
chmod -R 600 folder
Recursively chmod folder to 600
chown user :g roup file
Change file owner to user and group to group
head file1
Show first 10 lines of file1
tail file1
Show last 10 lines of file1
tail -f file1
Output last lines of file1 as it changes
Process Management
cmd1 | cmd2
ps
top
kill pid
pkill
read (r)
write (w)
execute (x)
name
killall
name
name
Watch a Command
watch -n 5 'ntpq -p'
Issue the 'ntpq -p' command every 5 seconds and
display output
cmd &
Run cmd in a subshell
Cheatographer
Dates
cheatography.com/davechild/
www.addedbytes.com
Sponsored by