Linux Shell Notes


Cursor movement short cuts

ctrl-a - move the cursor to the beginning of the current line
ctrl-e - move the cursor to the end of the current line
alt-b - move the cursor backwards one word
alt-f - move the cursor forward one word
ctrl-k - delete from cursor to the end of the line
ctrl-u - delete from cursor to the beginning of the line
alt-d - delete the word in front of the cursor
ctrl-w - delete the word behind of the cursor

Equality operators

||  logical or (double brackets only)
&&  logical and (double brackets only)
<   string comparison (no escaping necessary within double brackets)
-lt numerical comparison
=   string matching with globbing
==  string matching with globbing (double brackets only, see below)
=~  string matching with regular expressions (double brackets only , see below)
-n  string is non-empty        
-z  string is empty
-eq  numerical equality
-ne  numerical inequality

Shell command execution short cuts

!$ - all options to last command
 ^ssss^s - replace sss w/ s in the last command

Protect ourselves from errors and unset variables

set -o nounset
set -o errexit
set -o pipefail
set -o ignoreeof
shopt -s no_empty_cmd_completion

Commands to remember

shred -v -z -n 10 /dev/sde 
stress test a 4 CPU system
stress -c 4
THIS INFORMATION IS PROVIDED UNDER A GPLV2 LICENSE
THE GPLV2 LICENSE CAN BE VIEWED HERE