Chapter 14. Removing Files

The Cycle of Creation and Destruction

As a computer user, you spend lots of time creating files. Just as the necessary counterpart of life is death, the other side of file creation is deletion. If you never delete any files, you soon have a computer’s equivalent of a population explosion: your disks get full, and you must either spend money (buy and install more disk drives) or figure out which files you don’t really need.

In this chapter, we’ll talk about ways to get rid of files: how to do it safely, how to get rid of files that don’t want to die, and how to find “stale” files — or unused files that have been around for a long time. “Safe” deletion is a particularly interesting topic, because Unix’s rm command is extreme: once you delete a file, it’s gone permanently. There are several solutions for working around this problem, letting you (possibly) reclaim files from the dead.

— ML

How Unix Keeps Track of Files: Inodes

The ability to mumble about inodes is the key to social success at a Unix gurus’ cocktail party. This may not seem attractive to you, but sooner or later you will need to know what an inode is.

Seriously, inodes are an important part of the Unix filesystem. You don’t need to worry about them most of the time, but it does help to know what they are.

An inode is a data structure on the disk that describes a file. It holds most of the important information about the file, including the on-disk address of the file’s data blocks (the part of the ...

Get Unix Power Tools, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.