Skip to content

u/OpenGLaDOS

In this archive from Sep 2012 to Sep 2024

13
posts
158
comments
12
media
2.2k
score

Top posts

Top comments

A directory is a "special file" on unix that doesn't only have special calls for opening and reading, but also a separate one for deleting.

The usual delete call only removes a file name association from the parent directory (and deletes it afterwards if there are no references in other directories left), which allows programs to keep a file open even with no associated names. This is in contrast to OS like Windows which identify files by their name only.

However, this would keep the actual contents of the directory file (files and subdirectories and their contents) lingering, so the Berkeley unix developers introduced another call (and a tool of the same name) that only deletes empty directories to remind programmers of this fact, because you used to be able to actually damage the file system that way:

The unlink() system call traditionally allows the super-user to unlink directories which can damage the file system integrity. This implementation no longer permits it.

The rm utility does the recursive cleaning and removing of subdirectories for you with the -r (recursive) flag.

Of course you're right there's no sense in making a difference between deleting a regular file and an empty directory any more, so unlinkat can now do both and most people use rm -r to delete any kind of directory.

159 points

0x8B (or "‹" in Latin-1 encoding), which starts this wumble of characters, is the only printable character in the signature byte sequence for gzip compression, 1F 8B 08.

You're looking at data the web server dutifully compressed as requested by the browser, but forgot to tell that it did so.

79 points

Subreddits

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.