Text and search
16 articles, grouped by kind; the order follows the tracks.
Concepts 1
-
Regular expressions — patterns for grep, sed and awk
A regular expression is a pattern that many strings match; grep searches by it, sed replaces by it, awk selects lines.
6 mingrep -igrep -Egrep
Commands 15
-
cat — print a whole file
The cat command prints a file's contents to the terminal and joins several files into one stream.
5 mincatcat -ncat -A -
less — page through a long file with search
The less pager shows a long file or command output screen by screen — scroll, search by word, follow the end.
5 minlessless -Nless -S -
head — the first lines of a file
The head command prints the beginning of a file or of command output — 10 lines by default, -n sets how many.
4 minheadhead -nhead -c -
tail — the last lines and following a log
The tail command prints the end of a file, and with -f it keeps showing new lines as they are appended to a log.
5 mintailtail -ntail -f -
tee — output to a file and the screen
Splits a stream: writes to a file AND shows it on screen; sudo tee to write into protected files.
3 mincmdecho x -
grep — searching text
The grep command finds lines matching a pattern in files and command output: regex, recursion, context.
4 mingrep -igrep -rngrep -v -
wc — count lines, words and bytes
The wc command counts lines (-l), words (-w), bytes (-c) and characters (-m) in a file or in command output.
4 minwcwc -lgrep error -
sort — sort lines
The sort command orders lines of a file or command output: as text, as numbers (-n), by field (-k), reversed (-r).
6 minsortsort -nsort -rn -
uniq — remove or count repeated lines
The uniq command collapses adjacent identical lines and counts them with -c; sort almost always comes before it.
5 minsort file -
cut — cut fields out of lines
The cut command takes fields out of every line by a delimiter (-d and -f) or characters by position (-c).
5 mincutcut -c1-8cut -f2 -
sed and awk — editing and fields in a text stream
sed edits and deletes lines by pattern, awk splits lines into fields and computes over them, line by line.
10 minsed -nsedawk -
sort, uniq, cut, wc, tr — text stream processing
Small pipeline utilities; uniq only removes adjacent duplicates, so it almost always needs sort before it.
5 minsort -usort filecut -
diff and patch — comparing and applying changes
Comparing files and applying patches: diff two configs, see what changed, apply a patch.
4 mindiff -udiff -qrdiff -
jq — processing JSON on the command line
Parsing and filtering JSON on the command line — fields, arrays, filters, formatting.
4 minjqjq -rjq --arg -
hash — Bash command path cache
A Bash builtin for inspecting and clearing remembered paths to external commands.
4 mintype hashhelp hashhash
Nothing found. Try a shorter query.