Show Menu
Cheatography

Linux Keyboard Shortcuts (DRAFT) by

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

Bash Shortcuts

Moving the Cursor
Ctrl+a
Go to start of line
Ctrl+e
Go to end of line
Ctrl+p
Previous command (Up arrow)
Ctrl+n
Next command (Down arrow)
Alt+b
Go left (back) one word
Alt+f
Go right (forward) one character
Ctrl+XX
Move between the beginning of the line and the current position of the cursor
Deleting Text
Ctrl+D or Delete
Delete the character @ cursor
Alt+D
Delete all characters after the cursor on the current line
Ctrl+H or Backspace
Delete the character before the cursor
Cutting and Pasting
Ctrl+W
Cut the word before the cursor
Ctrl+K
Cut the part of the line after the cursor
Ctrl+U
Cut the part of the line before the cursor
Ctrl+Y
Paste the last thing you cut

ps shortcuts

Display all processes
$ ps ax
$ ps -ef
Use the "­u" option or "­-f" option to display detailed info
$ ps aux
$ ps -ef -f
Display process by [user]
$ ps -f -u [www-data]
Show process by name or pid
To search the processes by their name or command use the "­-C" option followed by the search term
ps -C apache2
To display processes by process id, use the "­-p" option and provides the process ids separated by comma
$ ps -f  -p 3150,7­298­,6544
The "­-C" must be provided with the exact process name. To search more flexibly, use grep
$ ps -ef | grep apache
Sort process by cpu or memory usage
$ ps aux --sort­=-p­cpu­,+pmem
Display the top 5 cpu cosuming processes
$ ps aux --sort­=-pcpu | head -5
Display process hierarchy in a tree style
$ ps -f --forest -C apache2
Display child processes of a parent process
finding all forked apache processes
$ ps -o pid,un­ame­,comm -C apache2
list all child processes
$ ps --ppid [2359]
Display threads of a process
$ ps -p [3150] -L
Change the columns to display
The following command shows only the pid, username, cpu, memory and command columns
$ ps -e -o pid,un­ame­,pc­pu,­pme­m,comm
rename the column labels
$ ps -e -o pid,uname=USERNAME,pcpu=CPU_USAGE,pmem,comm
 

Screen Shortcuts

screen -S name
start a screen session name
screen -rD name
resume a screen session name
screen -l
list 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 terminal
Ctrl-a p
Go to the previous instance of terminal
Ctrl-a "
Show current instances of terminals