Since this post is a snapshot in time. I recommend that you download a copy of the book which is updated frequently to improve and expand the content.
---------------------------------------
Having already established that everything is a file in a Linux operating system we find ourselves in the situation where files are suddenly slightly more interesting and mysterious, and it’s useful to get a better understanding of how files are represented in a Linux operating system so that the context of other functions can be better understood (thinking of links).
Linux files can be best understood by thinking of them as being described by three parts;
- The file name
- An inode
- The data
The file name
Individual file names are typically restricted to 255 characters and can be made up of almost any combination of characters. The only ‘special’ or ‘reserved’ character when assigning a file name is the forward slash (/
). This character is used solely to separate directories and file names as appropriate.
The other component of a file name is an inode number. This is a number assigned by the operating system which acts as a pointer to an inode (Index Node) which is an object that can be thought of as an entry in a database that stores information specifically about that file.
We can list the inode numbers associated with files by using the -i
option when listing files. For example;
The output (reproduced in edited form below) shows;
The numbers to the left of the file names are the associated inode numbers.
The file name and associated inode is in the directory that the file is contained in. Each directory (which is itself just a file) contains a table of the files it contains with the associated inode numbers.
/
). This character is used solely to separate directories and file names as appropriate.-i
option when listing files. For example;
I don't think you have mentioned mounting points in these blog posts. That's something pretty cool. In Windows, partitions are assigned alphabetic names, C:\, D:\, etc. In Linux, there is one master partition /, and the rest can be placed anywhere in the file tree, i.e. /mnt/dvd, /windows, etc. Even remote filesystems can be mounted through systems like NFS and used transparently by applications, though I think such systems are rarely used these days because Linux desktop environments already support remote access transparently.
ReplyDeleteThanks. I explain a bit more in the book (https://leanpub.com/jelinux of which this is a sub section) in the `mount` section. All the way through writing the book I have been fighting the urge to extend too much into networking and mounting filesystems via NFS and samba. I'd like to take a bit more time to learn some more before I go making a fool of myself :-).
DeleteMany thanks for all the comments and advice.