
Here's a preview from my zine, Bite Size Command Line!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
cat concatenates files
$ cat myfile.txt
prints contents of myfile.txt|
$ cat *.txt
prints all .txt files put together!
you can use cat as an EXTREMELY BASIC text editor:
- Run $ cat > file.txt
- type the contents (don’t make mistakes (smiley face))
- press ctrl+d to finish
cat -n
prints out the file with line numbers!
- Once upon a midnight..
- Over many a quaint.
- While I nodded, nearly
zcat
cats a gzipped file!
Actually just a 1-line shell script that runs gzip -cd
, but easier to remember.
tee
tee file.txt
will write. its stdin to both stdout and file.txt
stdin
> tee a.txt
> stdout
and a.txt
how to redirect to a file owned by root
$ sudo echo "hi">> x.txt
this will open x.txt as your user, not as root, so it fails!
$ echo "hi" I sudo tee -a x.txt
will open x.txt as root (smiley face)
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!