Explain a Command

A quick way to see what commands and their options do before running them.

Generate a random 16-char password
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 16 | tr -d '\n'
strings
strings(1)
print the sequences of printable characters in files
/dev/urandom
|
grep
grep(1)
print lines that match patterns
-o
-o, --only-matching

Print only the matched (non-empty) parts of a matching line, with each such part on a separate output line.

'[[:alnum:]]'
|
head(1)
output the first part of files
-n 16
-n, --lines=[-]NUM

print the first NUM lines instead of the first 10; with the leading '-', print all but the last NUM lines of each file

|
tr
tr(1)
translate or delete characters
-d
-d, --delete

delete characters in ARRAY1, do not translate

'\n'
Share

Sample Commands

Delete files extracted from a tarball
tar -tf file.tar.gz | xargs rm -r

Generate a random 16-char password
strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 16 | tr -d '\n'

Print the largest files or folders in the current dir
du -s * | sort -n | tail

Read More

From our blog:

Want to build something like this? Have a look at ManKier's API.

For another take on explaining commands, check out explainshell.com.