Show Menu
Cheatography

Linux Commands Cheat Sheet (DRAFT) by

Linux cheat sheet commands

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Nano Seacrhes

Files
Ctrl-R
Read File
Ctrl-O
Save file
Ctrl-X
Close File
Copy and Paste
Alt- A
Start Marking Text
Ctrl-K
Cut marked text or Line
Ctrl-U
Paste Text
Navigate File
ALT-/
End of file
Ctrl-A
Beginning of line
Ctrl-E
End of line
Ctrl-C
Show line number
Ctrl-_
Go to line number
Search File
Ctrl-W
Find
Alt-W
Find Next
Ctrl-\
Search and Replace

Getting Help

command --help
displays help message
man command
shows manual for that command
who am i
gives full details of the user
whoami
gives name of user
 

Standard Commands

ls
list directory content
cd..
change directory
cp
copy files
mv
move files
echo
Echo text
cat
display file content
ls--help
accessing help
rm
delete file
clear
screen clear
touch file1
file creation
mkdir
create directory
ls
list the content of the current directory
la -a
lists all files including hidden files
ls -1
displays permis­sions, owners­,size, date etc
-R
copies a directory its files and subdir­ect­ories to a destin­ation directory
rmdir
remove an empty directory
touch file
create an empty file
find
starts a find from the directory and searches the whole subtree from that point on
locate
check the database to see if a file matches the supplied name, won't work on recent files as database is only updated once a day
 

Bash Shortcuts

Ctrl-c
Stop current command
Ctrl-z
Sleep program
Ctrl-a
Go to start of line
Ctrl-e
Go to end of line
Ctrl-u
Cut from start of line
Ctrl-k
Cut to end of line
Ctrl-r
Search history
!!
Repeat last command
!abc
Run last command starting with abc
!abc:p
Print last command starting with abc
!$
Last argument of previous command
ALT-.
Last argument of previous command
!*
All arguments of previous command
^ abc 123
Run previous command replacing abc with 123
Bash Variables
env
Show enviro­nment variables
echo $NAME
Output value of $NAME
export NAME=value
Set $NAME to value
$PATH
Executable search path
$HOME
Home Directory
$SHELL
Current Shell
 

Screen Shortucts

screen
Start a screen session
screen -r
Resume a screen session
screen -list
Show your current screen sessions
Ctrl-A
Activate commands for screen
Ctrl-A c
Create a new instance of terminal
Ctrl- A n
Go to the next instance of a terminal
Ctrl-A p
Go to the previous instance of a terminal
Ctrl-A "
show current instances of terminals
Ctrl - A A
Rename the current instance
Process Management
ps
Show snapshot of processes
top
Show real time processes
kill pid
Kill processes with id pid
pkill name
Kill process with name name
killall name
Kill all processes with names beginning with name