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!

find searches a directory for files

find /tmp -type d -print
tmp: directory to search
-type d: which files
-print: action to do with the files

There are my favourite find arguments!

-name/-iname

case insensitive
the filename! eg
-name '*.txt'

-path /-ipath

search the full path!
-path /home/*/*.go

-type [TYPE]

f: regular file
d: directory
1: symlink
and more!

-maxdepth NUM

only descend NUM levels when searching a directory.

-Size O

find empty files! Useful to find files you created by accident

-exec COMMAND

action: run COMMAND on every file found

-print0

print null-separated filenames
Use with xargs -O!

-delete

action: delete all files found

locate

The locate command searches a database of every file on your system.

good: faster than find
bad: can get out of date

$ sudo updatedb

updates the database

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)