PRIMARY CATEGORY → SHELL SCRIPTING

Components ⟡


Shortcuts ⌨

Reference I    •    Reference II

Default ModeEmacs

Shorcuts’ Meaning
KeyMeaning
CControlC-cControl+c
MAltM-aAlt+a
SShiftS-oShift+o
SuperWindowsSuper-sWindows+s
ReturnEnterC-S-ReturnControl+Shift+Enter
-+C-zControl+z
{a,b,c,d}a b c dC-{a,b,c,d}C-a C-b C-c C-d
Emacs
Motion
ActionShorcut
Move to the Beginning/End of the LineC-a C-e
Move Backward/Forward One CharacterC-b C-f
Move Backward/Forward One WordM-b M-f
Move to the Beginning of the line
Return to the previous Position
C-x C-x
Edition
ActionShortcut
Delete all Characters Before/After the CursorC-u C-k
Delete One Word Backward/ForwardC-w M-d
Delete One Character Backward/ForwardC-h C-d
Yank (Paste the last element Deleted or Cut)C-y
Convert Word to Uppercase/LowercaseM-u M-l
History
ActionShortcuts
Move to Previous/Next CommandC-p C-n
Reverse/Forward Search (History Searching Mode)C-r C-s
Leave History Searching ModeC-g
Reverse Search - Run the Current CommandC-o
Misc
ActionShortcuts
Execute Command (Sames as Return)C-j
C-m
Clear the ScreenC-l
Interrupt Current Process (SIGINT)C-c
Suspend Current Process (SIGTSTP)C-z
Last Command Repetition (History Expansion)!!
Paste Previous Command’s Last ArgumentM-dot
!$
$_
Paste N Command’s Last Argument!-N:$
Toogle to Command Line EditorC-x C-e

Code Snippet

$ nvim foo.bash
#!/usr/bin/env bash
 
bash()
{
        case $( /bin/ps -p "$PPID" -o comm= ) in
 
                *bash)  return 0
                        ;;
 
                *)      printf "Shell is not a Bash. Exiting...\n" 1>&2
                        return 1
                        ;;
        esac
}
 
bash || exit 99
$ chmod u+x foo.bash
$ dash -c './foo.bash'
Shell is not Bash. Exiting...