UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 24.3 Unlinking Open Files Isn't a Good Idea Chapter 24
Other Ways to Get Disk Space
Next: 24.5 Limiting File Sizes
 

24.4 Save Space with a Link

You might have copies of the same file in several directories because:

ln
Instead of running cp, think about ln. (Your system should have ln. But it comes with the GNU fileutils, so it's on the Power Tools disc too.) There are lots of advantages to links (18.3). One big advantage of hard links is that they don't use any disk space. [1] The bigger the file, the more space you save with a link. A symbolic link always takes some disk space, so a hard link might be better (unless you have to link across filesystems so hard links can't be used).

[1] The link entry takes a few characters in the directory where you make the link. Unless this makes the directory occupy another disk block, the space available on the disk doesn't change.

Some people don't use links because they think all links to a file need to have the same name. That's not true. A link can be named myfile in one directory and file.allan in another directory-UNIX keeps it all straight.

- JP


Previous: 24.3 Unlinking Open Files Isn't a Good Idea UNIX Power ToolsNext: 24.5 Limiting File Sizes
24.3 Unlinking Open Files Isn't a Good Idea Book Index24.5 Limiting File Sizes

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System


Banner.Novgorod.Ru