Cheat sheets Oct 22 2023

Here is a list of cheat-sheets that I created for utilities and programs I enjoy using.

Read More...

Emacs - readline library cheat sheet Oct 22 2023

Bash Emacs Editing Mode Cheat Sheet

Bash’s default editing mode is Emacs. Here’s a list of the most useful shortcuts to help you navigate and edit the command line efficiently.

Cursor Movement

CommandDescription
C-aMove to the beginning of the line
C-eMove to the end of the line
C-bMove backward one character
C-fMove forward one character
M-bMove backward one word
M-fMove forward one word
C-lClear screen and redisplay the line

Editing Text

CommandDescription
C-dDelete the character under the cursor
C-hDelete the character before the cursor
M-dDelete the word after the cursor
M-DELDelete the word before the cursor
C-kKill from cursor to end of line
C-uKill from cursor to beginning of line
C-wKill the word behind the cursor
M-tTranspose (swap) the last two words
C-tTranspose (swap) the last two characters
C-yYank (paste) the last killed text

Command History

CommandDescription
C-pPrevious command in history
C-nNext command in history
M-<Move to the first command in history
M->Move to the last command in history
C-rReverse search through history
C-sForward search through history (might be disabled in some terminals)

Miscellaneous

CommandDescription
C-_ or C-x C-uUndo the last editing command
C-x C-eEdit the current line in an external editor (usually vi or emacs)
M-&Run the previous command in the background
C-v or M-vInsert the next character typed literally (e.g., allows input of control characters)

Note: In this cheat sheet, C stands for the Control key and M stands for the Meta key (usually the Alt or Option key). Combining C or M with a character means pressing the Control or Meta key, respectively, while also pressing that character.

Read More...

Screen - terminal multiplexer cheat sheet Oct 22 2023

The following is a short list of the most common keybindings for the screen terminal multiplexer.

CommandDescription
C-a ?Get the screen help, and shows some keybindings
C-a cCreate a new window
C-a nSwitch to the next window
C-a p or Ctrl-a -Switch to the previous window
C-a 0 to C-a 9Switch to window number 0-9
C-a C-aToggle between the current and last window
C-a ARename the current window
C-a w or C-a "Show a list of windows
C-a <Space>Switch to the next region
C-a <Backspace>Switch to the previous region
C-a <Tab>Move to the next region
C-a SSplit display horizontally
C-a | or C-a VSplit display vertically
C-a QClose all regions except the current one
C-a XClose the current region
C-a \Close current session
C-a :resizeResize region
C-a :fitResize window to fit the terminal size
C-a :layout save <name>Save current layout as <name>
C-a :layout load <name>Load layout named <name>
C-a :layout nextLoad next layout
C-a :layout prevLoad previous layout
C-a :layout title <title>Set the title of the current layout
Read More...

Tmux - terminal multiplexer cheat sheet Oct 22 2023

The following is a short list of the most common keybindings for the tmux terminal multiplexer.

Starting tmux

CommandDescription
tmuxStart a new session
tmux new -s nameStart a new session with a name
tmux aAttach to the last session
tmux a -t nameAttach to a named session
tmux lsList sessions

Session Management

CommandDescription
C-b dDetach from the current session
C-b $Rename the current session
C-b sList sessions (navigate with arrow keys)

Windows (Tabs)

CommandDescription
C-b cCreate a new window
C-b ,Rename the current window
C-b wList windows
C-b nNext window
C-b pPrevious window
C-b 0 to 9Go to window number 0-9
C-b &Close the current window

Panes (Splits)

CommandDescription
C-b %Vertical split
C-b "Horizontal split
C-b oSwitch to the next pane
C-b ;Toggle to the last pane
C-b xClose the current pane
C-b [Space]Toggle pane layouts
C-b q followed by a numberQuickly select a pane by number
C-b { or C-b }Swap panes

Misc Commands

CommandDescription
C-b tShow the time
C-b ?List all keybindings
C-b zZoom in/out on a pane
C-b [ and C-b ]Enter/Exit copy mode
C-b :Enter command mode

Configuration

~/.tmux.conf is the configuration file for tmux. You can customize settings and keybindings there.

Read More...

Vi - readline library cheat sheet Oct 22 2023

Bash Vi Editing Mode Cheat Sheet

In Bash, you can switch to Vi editing mode with the command set -o vi. Here’s a collection of the most useful shortcuts in Vi mode.

Modes

In Vi mode, you start in “command mode” where you can navigate and manipulate text but cannot insert new text. To insert or append text, you’d enter “insert mode.”

CommandDescription
EscEnter command mode
iEnter insert mode (before cursor)
IEnter insert mode (beginning of line)
aEnter insert mode (after cursor)
AEnter insert mode (end of line)
REnter replace mode

Cursor Movement

CommandDescription
hMove cursor left
lMove cursor right
jMove to previous command in history
kMove to next command in history
wMove forward one word
bMove backward one word
0 or ^Move to beginning of line
$Move to end of line

Editing Text

CommandDescription
xDelete the character under the cursor
XDelete the character before the cursor
dwDelete word from cursor to word end
dbDelete word from cursor to word start
D or d$Delete to end of line
d^Delete to beginning of line
ddDelete entire line
uUndo the last change
Ctrl-rRedo the last undo
pPaste text after cursor
PPaste text before cursor

Command History

CommandDescription
/Search backward in command history
?Search forward in command history
nRepeat the last / or ? command

Miscellaneous

CommandDescription
: followed by a commandExecute a command (e.g., :ls will run the ls command)
vEdit the current line in an external editor (usually vi or vim)

Note: Always remember that you start in command mode in Vi mode. Use i, I, a, A, or R to enter different variations of insert or replace mode.

Read More...