May 17, 2008

The root Directory

The root Directory

Command ls / this command lists the root directory

[agustin@server2 agustin]$ ls /
        bin/    boot/   dev/    etc/    home/   initrd/ lib/    mnt/    opt/
        proc/   root/   sbin/   tmp/    usr/    var/

Throughout the decade, developers had tried to define standards for the file system hierarchy and for what each of these directories should be used for. But even with the efforts of all these people there are still variations among all distributions.

/

root directory of the entire system

/bin

holds system executables

/sbin

holds system executables and are essential for starting up the system

/boot

holds the files needed during the booting process including the kernel

/dev

it is a special directory that holds information regarding peripherals /dev/ttys0, /dev/had, etc.

/home

holds all the home directories for all users except root

/lib

holds system binary libraries, shared libraries and kernel module

/opt

here is where optional applications might go

/root

this is the home directory for super user, do not confuse this folder with /

/tmp

Here is where temporary files are stored; it is usually emptied when systems restart.

/var

is where variable system files go, system logging, file locks, printer Spooling, mail spooling and many others.

/etc

This directory holds almost all configuration files. As administrator you will spending most of your time tweaking settings in this folder.

/initrd

this directory is used at boot time, in the initrd to perform pivot_root

/mnt

This directory is used as a mount point. Here you can temporarily mount medias such as CD-ROM, zip and other file systems. Example: /mnt/windows, /mnt/floppy, mnt/cd-rom

/proc

this directory is used as a kernel information access hooks, example of usage:

[agustin@server2 proc]$cat cpuinfo
[agustin@server2 agustin]$cat filesystems

/usr

It is a very large directory, holds application programs; it also has several important additional directories.

/usr/bin

contains binaries executables

/usr/include

This directory contains C headers with various libraries applications.

/usr/local

application programs used locally

The Print working directory command: pwd

 
        [agustin@server2 agustin]$ pwd
        /home/agustin
        [agustin@server2 agustin]$
 

The command whoami, displays who you are at the current prompt

[agustin@server2 agustin]$ whoami
agustin

[agustin@server2 agustin]$

If you want to know who is logged into the entire system use the who command

        [agustin@server2 agustin]$ who
        agustin vc/1    Aug 17 07:38
        root           vc/2    Aug 19 06:51
        user1          vc/3    Aug 19 06:46
 
        [agustin@server2 agustin]$

Switching from regular user to root
To gain root's power temporarily use: su

[agustin@server2 agustin]$ su
Password:*******       (when you  are typing the password, you can not  see it)

[root@server2 agustin]# whoami
root

[root@server2 agustin]#

Observe your prompt, it has been changed. When you are in this mode you can do anything; be careful how you use the super user account. Protect the root account at all cost.

The root account is strictly used for system administration. Any regular user cannot do things that are strictly for root unless root grants the right to the user.

No comments:

Post a Comment

Popular Posts