Skip to Content
Navigation:

A stick figure smiling

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!

Image of a comic. To read the full HTML alt text, click "read the transcript".

browse more comics! get the zine!
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:

  1. Run $ cat > file.txt
  2. type the contents (don’t make mistakes (smiley face))
  3. press ctrl+d to finish

cat -n

prints out the file with line numbers!

  1. Once upon a midnight..
  2. Over many a quaint.
  3. 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!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)