Slides from last lecture: regex.pdf
Regex101: https://regex101.com/
vi/vim is my preference. Big learning curve, could make yourself a lot more efficient.
vi/vim: <ESC>:q! – <C-c> will not work here!emacs are some others’ preference. The bash shell supports limited emacs bindings by default.nano/pico are the simplest to use. Use your default arrow keys to move around and <Ctrl> keys
for operations.<C-r> for searching through history (saved to $HISTFILE)unset, export, echo to remove, add, and write to
stdout the variables*, background tasks &, return codes $?, repeat expression !!<(), command substitution via $()>, <, >>, 2>, 1>, &>, 2>&1, etc.
/dev/null exists to redirect to nothing/dev/random for random data/dev/zero for null bytesReferences for input/output redirection on The Linux Documentation Project page.
If you’re curious about /dev/random/ vs /dev/urandom, this Stack Exchange
post is a
good read.
The man pages coveres all syntax. Here are the most important bits:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
SYNOPSIS
awk [ -F fs ] [ -v var=value ] [ 'prog' | -f progfile ] [ file ... ]
An input line is normally made up of fields separated by white space, or by the regular expression FS.
The fields are denoted $1, $2, ..., while $0 refers to the entire line.
If FS is null, the input line is split into one field per character.
A pattern-action statement has the form:
pattern { action }
A missing { action } means print the line; a missing pattern always matches.
Pattern-action statements are separated by newlines or semicolons.
The special patterns BEGIN and END may be used to capture control before the first input line is read and after the last.
BEGIN and END do not combine with other patterns.
They may appear multiple times in a program and execute in the order they are read by awk.
Variable names with special meanings:
FS regular expression used to separate fields; also settable by option -Ffs.
NF number of fields in the current record.
NR ordinal number of the current record.
EXAMPLES
length($0) > 72
Print lines longer than 72 characters.
{ print $2, $1 }
Print first two fields in opposite order.
BEGIN { # Simulate echo(1)
for (i = 1; i < ARGC; i++) printf "%s ", ARGV[i]
printf "\n"
exit }
I suggest reading perldoc perlintro in full
I’ve included a reference list of commands at the end of this article. This is not exhaustive (of course), but rather the commands that I think are most commonly used and that you might find helpful in your day-to-day operations.
Please note that only audio was recorded for this lecture.
ar/tarawkbase64bcbg/fgcat (tac)chmodclearcpcurl/wgetcutdatedf/dudiffdigechofilefindfmtfoldgdb gitgrepgzheadhexdumpidjoinkillless/morelsltracemanmvncpasswdpasteperlpingprintfpspwdrmsedseqsftp/tftp/ftpsortsplitssh/scpstatstringssu/sudosumtailteetimetmuxtouchtrtrue/falseumaskunameuniqvi/vim/nanowwatchwcwhichwhoamiwhoisxargsyeszip/unzip