tr – translate or delete characters.

Usage: tr [OPTION]… SET1 [SET2]

-d: delete characters in SET1
-c: use the complement in SET1

Example:

$ < /dev/urandom tr -dc 0-9 | head -c 32; echo;

33261040930333248934207200460197

 

fold – wrap each input line to fit in specified width

Usage: fold [OPTION]… [FILE]…

-w=WIDTH: use WIDTH columns (instead of 80)

Example:

$ cat LICENSE.md

The MIT License (MIT)

$ cat LICENSE.md | fold -w 10

The MIT Li
cense (MIT
)

 

rev – reverse lines of a file or files

Usage: rev [-V] [-h] [file …]

Example:

$ echo 'hello world!' | rev

!dlrow olleh

 

cut – remove sections from each line of files

Usage: cut OPTION… [FILE]…

-c LIST: select only these characters (Note: index starts from 1)
-d DELIM: use DELIM instead of TAB as field delimiter (Note: must combine with -f)
-f LIST: select only these fields
-s: do not print lines not containing delimiters
-output-delimiter=STRING (similar to OFS in awk)

Example:

$ cat test.txt

cat command for file oriented operations.
cp command for copy files or directories.
ls command to list out files and directories with its attributes.

$ cat test.txt | cut -c 1-3   # from 1 to 3 (first 3 characters)

cat
cp 
ls 

$ cat test.txt | cut -c 5-    # from 5 to the end

command for file oriented operations.
ommand for copy files or directories.
ommand to list out files and directories with its attributes.

$ cat test.txt | cut -d' ' -f2,4

command file
command copy
command list

$ cat test.txt | cut -d'p' -s -f1

cat command for file oriented o
c

Reference: cut

 

netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

Usage: netstat [OPTION]

-a: list all ports (both listening and non-listening sockets)
-l: list all ports that are listening
-p: list all ports and their process ID
-i: display a table of all network interfaces

Could be combined with:
-t: TCP
-u: UDP

 

grep – print lines matching a pattern

Usage: grep [OPTIONS] PATTERN [FILE…]

-e [PATTERN]: use PATTERN as the pattern
-f FILE: obtain patterns from FILE
-l: print filename instead of line
-n: prefix each line of output with the 1-based line number within its input file

 

crontab – commands that run on a regular schedule

Reference: crontab

 

uniq – report or omit repeated lines

Usage: uniq [OPTIONS] [INPUT]

-u: only print unique lines
-d: only print duplicate lines
-c: prefix lines by the number of occurrences
-i: ignore diff in case