Get random numbers or random words in Linux command line with shuf.

Get a random port number with shuf command:

shuf -n 1 -i 1024-65535

Write it directly into a new variable:

RANDOM_PORT=`shuf -i 1024-65535 -n 1`

Get random word from a word list:

shuf -n 1 /usr/share/dict/words

Download the content of an URL to a file
curl http://example.com/text.txt -o filename.txt

Download the content of a URL and safe it by the given name
curl -O http://example.com/text.txt

Create a tar archive
tar -cf archive.tar file1 file2 ... fileN

Create tar archive from a directory
tar -cf archive.tar /path/to/directory/

Create a tar gzipp’d archive
tar -zcf archive.tar.gz file1 file2 ... fileN

Create a tar gzipp’d archive from a directory
tar -zcf archive.tar /path/to/directory/

Create multi-part tar archives from a directory
tar cf - /path/to/directory|split -b<max_size_of_part>M - archive.tar

Extract all files from a tar archive
tar -xf archive.tar

Extract all files from a tar gzipped archive
tar -zxf archive.tar.gz

Extract all files from a tar gzipped archive into a directory
tar -xzf archiv.tar.gz -C /path/to/directory/

Extract a single file from a tar archive
tar -xf archive.tar the_one_file