September 15, 2009
Well sorry it has taken so long but here is the third installation in the series on the Linux file system. In case you haven’t been following before now, here are the links to part1 and part2.
In this portion I will discuss the following directories/partitions: /lost+found /lib /mnt and /tmp.
So you are working and all of a sudden there is a power outage. Or even worse your system suddenly crashes for no reason. Well the next time you boot up your machine Linux will try to recover any lost data/files. The result of this recovery attempt will be saved here. Sure the files in here might not make much sense but there is a small chance that there might be something that you might be able to actually use. Finally, for those of you that really want to know, this recovery is done by using the
fsck command. Look into it yourself, since this isn’t the place to go into depth on it.
The location of all the shared library files. Think DLL files on Windows.
This is the generic place to mount other file systems. Such as internal/external hard drives, CD-ROMS, DVD, and floppy disk if people still use those. For more information on mounting see the link to the post dedicated to this topic. But I should mention that you can make any location a mount point, but it’s usually a good idea to have them all relatively “close” to each other. Plus try not to overdo it, because really 50 different mount points might just be a little excessive.
Temporary files are stored here. In other words, DON’T SAVE IMPORTANT STUFF HERE! This directory is cleared upon each reboot of the system. As a side note, this is really useful for getting around disk quotas. Just save your files here and then when you restart they will be gone. All you have to do is make sure that you won’t be needing those files ever again.
September 5, 2009
You just moved over from Window and are now working with Ubuntu. The only problem is that you have no idea how the file system is laid out. In Windows you know that there are partitions
D:\ (usually the recovery partition/drive) and
C:\ (which acts like the main partition/drive). Even further, these partitions are visible when you boot up your computer so you don’t have to worry about mounting them.
Now as for a Linux system, EVERYTHING IS A FILE!!! (and if it isn’t a file it’s a process). Directories like
/home (similar to
C:\Users\[user name] in Windows) is just a special kind of file, that contains “pointers” do it descendants. At this point I should mention that in Linux the file system is set up like a tree, with root node
/. Those of you that are familiar with working in DOS will have to get use to using / to navigate between directories and not \. Really it’s not that hard to do, but does take some getting used to. And if you are going to say “Why does Linux not adhere to the standard?” Just remember that Linux is based off of Unix which has been around much longer than Windows. Additionally Windows doesn’t have a great track record when it comes to adhering to standards (IE for example). Something else to keep in mind is that file names are case sensitive. That means that THIS.txt is different from tHiS.txt or This.txt and even this.txt. In Windows this isn’t the case (Thanks Kevin telling me this. I always entered file names as if they were case sensitive when working with Windows.)
Remember earlier when I said that under Windows you don’t have to mount drives/partitions once you boot up the system? Well under Linux you don’t have this convenience. However, there are some advantages to this set up, so you shouldn’t cry too much. For instance the /usr (the file that contains most of the system executables, I’ll talk about this more later) can be mounted from another computer on your network and everything will work just fine. Just try moving the folder
C:\WINDOWS to another location (have fun fixing your registry errors if you actually do this by the way). The reason this will work under Linux is because it will still see
/usr as a local directory that’s part of the local directory structure.
It is finally time to talk about the different parts of the Linux file system. To see what the directories under / are just go to that directory and enter
ls -p. The entries with a / after them are directories, everything else is just a regular file.
On my system the list of directories is:
/bin /boot /dev /etc /home /initrd /lib /lib32 /lost+found /media /mnt /opt /proc /root /sbin /srv /sys /tmp /usr /var
/lib32 directory seems to be special to 64-bit machines so I won’t be talking about it. However, I figure that it is similar to
/lib, but provides support for 64-bit systems.
In part 2-and part 3, if it is needed, I will discuess each of these directories. Nothing too detailed but it should provide you with a good starting point.
August 4, 2009
Not too much is new in Linux world. Still mostly working on SPOJ problems and browsing the internet. So nothing all that exciting yet.
However, I did manage to learn how to use the
mount command. The general format is
mount [source] [destination]
Here is an example: mount /dev/sda1 /media/disk The colors are so that you can easily follow which is the destination and which is the source. I probably should mention at this time that I am running Ubuntu from an external HD (otherwise I run Vista) so if I ever want to access any of the files on my internal HD I must first mount it.
Well that wasn’t too hard. Though if you don’t want to bother with this Ubuntu does have a graphical way to do this. Just go to Places and the drive you want to mount should be in the drop down list. Personally I never knew the source of my internal HD until I ran
df -h. This displaces the space used by each available disk (internal, external, etc.). The
-h flag tells the system to display the information in amounts humans can more easily understand (kB, MB, GB, and so on).