...Incoming burst...


Here comes a quick dump of usage tips for useful utilities found in the moreutils package.

I’ll be updating this post in the days to come to make it more readable

The Dump

chronic (runs a command quietly unless it fails)

chronic rsync -av ~/Documents/ ~/Backup
chronic sh /home/frodo/scripts/email_bkp.sh

combine (line in two files using boolean operations)

combine file1 and file2

errno (lookup errno names and description)

errno eintr
errno 4

ifdata (get network interface info w/o parsing ifconfig output)

ifdata -pa br0
ifdata

ifne (run a program if the standard input is not empty)

find . -mtime -7 | ifne echo "Found something"

isutf8 (check if a file or standard input is utf-8

isutf8 file.txt && echo "Yes, it is UTF8"

lckdo (execute a program with a lock held)

lckdo mylock some-script & lckdo -w mylock echo "Done"

mispipe (pipe two commands, returning the exit status of the first)

mispipe "echo hi" "false"

parallel (run multiple jobs at once)

parallel -- "echo one" "echo two" "echo three"

pee (tee standard input to pipes)

cat file | pee "sort -u > sorted" "sort -R > unsorted"

bash doesn’t need pee

cat file| tee >(sort -u > sorted) >(sort -R > unsorted)

sponge (soak up standard input and write to a file)

sort file | sponge file

because below you will end up with an empty file

sort file > file

ts (timestamp standard input)

tail -f /var/log/mylog | ts > timestamped-log.txt

vidir (edit a directory in your text editor)

vidir ~/
vidir .

vipe (insert a text editor into a pipe)

sort file | vipe | head

zrun (automatically uncompress arguments to command)

zrun sort file.gz


...Sent by Lazy Monkey...