Linux 101: file structure/hierarchy

File structure is the basic things people get confuse when start using Linux. Most people nowadays are likely to stick with Windows’ idea, e.g.C:\Windows\ or C:\Program files\ or C:\Users\xxxx. That’s pretty easy to understand. *nix file structure was confusing at first, but it’s not that hard to understand. In order to learn using it, then you have to know where things are first.

In *nix system, everything is a file. Whatever they are, they are represented in file format. There is no extension to distinguish any type of file, but utility called file can identify it. directory is also one kind of file. Process is also represented in file. We’ll talk about ‘file’ in detail later. Ok, I got to start with what each of directory in *nix is for.

/ Every tree needs root, file structure is also the same.
/boot This is for boot loader files, e.g. GRUB, KERNEL, SYSTEM.MAP, VMLINUZ, INITRD, …
/bin bin == binary; it contains commands stuff and /bin is for essential ones only.
/etc This is for any system configuration; if you ever need to adjust things, this is likely to be the place to go.
/sbin it doesn’t differ to /bin that much, but it contains system utilities that don’t need that much speed.
/home This is the same as c:\users in Windows’ sense. Just contain any thing of each user in /home/<usr> commonly.
/usr This is not where users store file, but it has hierarchy like / too. /usr/bin, /usr/lib, /usr/local/share, /usr/share, for example. What difference between /usr/bin and /bin is /bin usually contains kernel command while /usr/bin contains user commands that are not related to kernel/OS At first, /bin was designed to use in different disk (faster one) and the rest will be in /usr/bin or /usr/local/bin.
/usr/bin
vs /usr/local/bin
The difference is /usr/bin stored user commands while /usr/local/bin stored local software
/opt That’s for application software, such as Thunderbird and such.
/root This is home for root =)
/tmp tmp == temporary; it uses as its name.
/var var == variable. It uses to store configuration, logging and application information
/mnt mnt == mount point; some distros use this, some don’t, some even use /Windows or /media instead of this

note: basically each of these will be in different partition/disk as well, so there is another factor involved, speed. That’s why it has commands in all over the place. Some utilities are just more important than others.

Above matrix should cover basic filesystem structure. As usual, different distribution might have a bit of different point of view, but they all share the same idea =) After knowing each of these files are for, then you will know where to expect particular files or things you need. Have fun with *nix experience.

Popularity: 14% [?]

Linux 101: grub recovery

When you messed with many OSs, boot strap loader might point to somewhere you don’t want it to be. grub considering the best – easiest? – to deal with many OSs and of course, it’s easy to tweak or  adjust as well.

Firstly get into any sort of shell. There are basically 2 parts needed to be done: set active partition and set MBR back to point at grub again. The first part is fdisk, there is ‘m’ for help. All you have to do is set the partition where grub is to active. Others are not.

The second part: set MBR point back to grub. That’s easy via grub command shell

grub-shell

The easiest way to find partition referenced by grub is to find it

find /boot/grub/menu.lst

Then you have to set toot and setup the hard drive. Then you are all set. For grub menu, Linux needs

Title XXX
   root (hd0,0)
   kernal /boot/vmlinuz root=/dev/…bla bla bla
   initrd /boot/initrd

For Windows, you just need to link to Windows boot loader again.

Title Windows XX
   rootnoverify (hd0,0)
   chainloader (hd0,1)+1 # this is Windows partition.

That’s all you have to do. pretty easy, right?

Popularity: 2% [?]

Photoshop 101 – keyboard shortcut for switching tools

photoshop_toolbarI always find Photoshop such a great tool, but it’s quite annoying that I couldn’t find how to switch between tool (in the same group) quickly.

Then: It’s the same keyboard shortcut, so how can I switch between them then? Hold ‘G’ would not do it, Ctrl + ‘G’ is not right. As a result, I have to stick with hold the left click and switch it.
Now: Just hold shift + ‘G’ (or whatever key you want) to rotate tools in the group. That’s easy, right? I really wish I knew this long time ago!!

Popularity: 23% [?]