227
An amazing directory: /proc
(europe.pub)
A community for everything relating to the GNU/Linux operating system (except the memes!)
Also, check out:
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
Just to kind of confirm this:
ls -ldoes not show them like hard links, but rather like soft/symbolic links.But when I do
tail -f /path/to/file.txton a file (to keep it open in a process) and then delete the file, I get this output inls -l:The
3seems to just be an incrementing number for each file opened by the process. And then, well, obviously the file isn't now called "file.txt (deleted)". That is just a name the kernel makes up whenls -lasks it what's in that directory.So, presumably the kernel keeps a separate copy of that file in memory until the process closes the file or is terminated. And then exposes it through this pseudo-softlink rather than making use of hardlinks.
FWIW: https://en.wikipedia.org/wiki/File_descriptor#file_descriptor_table
If you throw an
straceon a process that interacts with the filesystem you'll see that stuff likeopen()returns a file descriptor and stuff likeread()takes a file descriptor as an argument.These are also generally the numbers you're using when you do I/O redirection in your shell with stuff like
2>&1orexec 5< ./some_file.txt