by unhammer · 2y ago · 0 comments
cat /dev/sdb > backup.img # make a disk image
cat /dev/sdb > /dev/sdc # clone disk
cat ~/Downloads/* # play Russian roulette with your terminal
cat > file # minimalistic text editor, ^D to exit saving, ^C to exit erasing the file
cat << wq > file # nearly complete emulation of ed
grep -r bongo . | cat # shorter than typing --color=never
cat -v file # cause 20 points of damage to wizards of bell labs
cat file > file # empty a file without removing the file
cat meow meow > meows # duplicate file contents dostuff () {
if [[ $1 = clean ]]; then
grep -v dirt
else
cat
fi | do_other_stuff
}
See also https://www.in-ulm.de/~mascheck/various/uuoc/ (via https://lobste.rs/s/rtvp2u/useful_uses_cat#c_0xpqkr )