unix file hierarchy. the unix/linux file system hierarchy cis 191 – lesson 3 / /bin /boot /dev...
Post on 28-Mar-2015
229 Views
Preview:
TRANSCRIPT
UNIX File
Hierarchy
The UNIX/Linux File System Hierarchy
CIS 191 – Lesson 3
/
/bin
/boot
/dev
/etc
/home
/lib
/lost+found
/mnt
/opt
/proc
/root
/sbin
/tmp
/usr
CIS 191 – Lesson 1Directory Contents/ the root directory, the top-level directory in the FHS
/bin binary files forming the commands and shells used by the system administrator and users
/boot files used during the initial boot-up process including the kernel
/dev device files for connected hardware
/etc system configuration files
/home individual home directories owned by each user
/lib shared libraries needed to boot the system and run the commands in the root filesystem (i.e. commands in /bin and /sbin)
/lost+found recovered files that were corrupted by power failures or system crashes
/mnt mount points for floppies, cds, or other file systems
/opt add-on software packages and/or commercial applications
/proc kernel level process information
/root home directory for the root user
/sbin system administration commands reserved for the superuser (root)
/tmp temporary files that are deleted when the system is rebooted or started
/usr program files and related files for use by all users
/var variable data such as log files, print spool files, and mail queues
Basic File Hierarchy Standard Directories
/
/etcfstabgrouphostshosts.allowhosts.denyhttpd/ conf/ httpd.conf inittabissuemodules.confmotdmtabpam.d/ loginpasswdprofilerc.d/ rc rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rc.sysinit
/sbinarpbastillechkconfigdebugfsdhclientdmesgdumpe2labelfdiskgrubhaltifconfiginitinsmodiptableslsmodlspcimingettymkfspartprobeportmapquotaonquotaoffrestorermmodrouteserviceshutdowntripwiretune2fs
/binbashcatchgrpchmodchowncpcpiodatedddfdmesgechoenvgrephostnamelnlsmailmkdirmoremountmvnetstatpingpsrmrmdirrpmsleepsortsutartouchumountunamevi
Example GNU/Linux Directory Structure
/bootgrub/ grub.confinitrd-2.4.20-6.imgvmlinuz-2.4.20-6
/usrbin/ at bc cal cancel clear crontab fdformat file find finger gcc head id info less lp/lpr lpstat make man mesg mozilla openssl passwd perl quota scp spell ssh sudo tail tee telnet wc who write xxd
/root.bash_profile.bashrc
sbin/ crond cupsd httpd kudzu pppd sendmail sshd traceroute useradd usermod userdel xinetd X11R6/ bin/ startx twm X xclock xinit xsetroot xwd
/varlog/ Bastille/ Assessment/ assessment-report.html dmesg httpd/ access_log error_log spool/ clientmqueue
/procinteruptsioportsmodulessys/ net/ ipv4/ ip_forward
resolv.confsecurettyshadowsysctl.confsysconfig/ network network-scripts/ ifcfg-eth0xinetd.d/ telnet
/lib modules/ 2.4.20-6/ kernel/ drivers/ net/ 3c59x.o
/homersimms/.bash_profile.bashrc
/mntcdrom/floppy/
/optlampp/ bin mysql htdocs phpmyadmin/ index.php sbin/ mysqld
/tmpssh-XXjXuIH9/ agent.13695
/devhdahda1had2tty1
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
[root@tomcat ~]# ls /bin dev home lost+found misc net proc sbin srv tmp varboot etc lib media mnt opt root selinux sys usr[root@tomcat ~]#
/
/etcfstabgrouphostshosts.allowhosts.denyhttpd/ conf/ httpd.conf inittabissuemodules.confmotdmtabpam.d/ loginpasswdprofilerc.d/ rc rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rc.sysinit
/sbinarpbastillechkconfigdebugfsdhclientdmesgdumpe2labelfdiskgrubhaltifconfiginitinsmodiptableslsmodlspcimingettymkfspartprobeportmapquotaonquotaoffrestorermmodrouteserviceshutdowntripwiretune2fs
/binbashcatchgrpchmodchowncpcpiodatedddfdmesgechoenvgrephostnamelnlsmailmkdirmoremountmvnetstatpingpsrmrmdirrpmsleepsortsutartouchumountunamevi
Example GNU/Linux Directory Structure
/bootgrub/ grub.confinitrd-2.4.20-6.imgvmlinuz-2.4.20-6
/usrbin/ at bc cal cancel clear crontab fdformat file find finger gcc head id info less lp/lpr lpstat make man mesg mozilla openssl passwd perl quota scp spell ssh sudo tail tee telnet wc who write xxd
/root.bash_profile.bashrc
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
sbin/ crond cupsd httpd kudzu pppd sendmail sshd traceroute useradd usermod userdel xinetd X11R6/ bin/ startx twm X xclock xinit xsetroot xwd
/varlog/ Bastille/ Assessment/ assessment-report.html dmesg httpd/ access_log error_log spool/ clientmqueue
/procinteruptsioportsmodulessys/ net/ ipv4/ ip_forward
resolv.confsecurettyshadowsysctl.confsysconfig/ network network-scripts/ ifcfg-eth0xinetd.d/ telnet
/lib modules/ 2.4.20-6/ kernel/ drivers/ net/ 3c59x.o
/homersimms/.bash_profile.bashrc
/mntcdrom/floppy/
/optlampp/ bin mysql htdocs phpmyadmin/ index.php sbin/ mysqld
/tmpssh-XXjXuIH9/ agent.13695
/devhdahda1had2tty1
CIS 90 files, directories, commands
/
/etcfstabgrouphostshosts.allowhosts.denyhttpd/ conf/ httpd.conf inittabissuemodules.confmotdmtabpam.d/ loginpasswdprofilerc.d/ rc rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rc.sysinit
/sbinarpbastillechkconfigdebugfsdhclientdmesgdumpe2labelfdiskgrubhaltifconfiginitinsmodiptableslsmodlspcimingettymkfspartprobeportmapquotaonquotaoffrestorermmodrouteserviceshutdowntripwiretune2fs
/binbashcatchgrpchmodchowncpcpiodatedddfdmesgechoenvgrephostnamelnlsmailmkdirmoremountmvnetstatpingpsrmrmdirrpmsleepsortsutartouchumountunamevi
Example GNU/Linux Directory Structure
/bootgrub/ grub.confinitrd-2.4.20-6.imgvmlinuz-2.4.20-6
/usrbin/ at bc cal cancel clear crontab fdformat file find finger gcc head id info less lp/lpr lpstat make man mesg mozilla openssl passwd perl quota scp spell ssh sudo tail tee telnet wc who write xxd
/root.bash_profile.bashrc
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
sbin/ crond cupsd httpd kudzu pppd sendmail sshd traceroute useradd usermod userdel xinetd X11R6/ bin/ startx twm X xclock xinit xsetroot xwd
/varlog/ Bastille/ Assessment/ assessment-report.html dmesg httpd/ access_log error_log spool/ clientmqueue
/procinteruptsioportsmodulessys/ net/ ipv4/ ip_forward
resolv.confsecurettyshadowsysctl.confsysconfig/ network network-scripts/ ifcfg-eth0xinetd.d/ telnet
/lib modules/ 2.4.20-6/ kernel/ drivers/ net/ 3c59x.o
/homersimms/.bash_profile.bashrc
/mntcdrom/floppy/
/optlampp/ bin mysql htdocs phpmyadmin/ index.php sbin/ mysqld
/tmpssh-XXjXuIH9/ agent.13695
/devhdahda1had2tty1
CIS 191 files, directories, commands
/
/etcfstabgrouphostshosts.allowhosts.denyhttpd/ conf/ httpd.conf inittabissuemodules.confmotdmtabpam.d/ loginpasswdprofilerc.d/ rc rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rc.sysinit
/sbinarpbastillechkconfigdebugfsdhclientdmesgdumpe2labelfdiskgrubhaltifconfiginitinsmodiptableslsmodlspcimingettymkfspartprobeportmapquotaonquotaoffrestorermmodrouteserviceshutdowntripwiretune2fs
/binbashcatchgrpchmodchowncpcpiodatedddfdmesgechoenvgrephostnamelnlsmailmkdirmoremountmvnetstatpingpsrmrmdirrpmsleepsortsutartouchumountunamevi
Example GNU/Linux Directory Structure
/bootgrub/ grub.confinitrd-2.4.20-6.imgvmlinuz-2.4.20-6
/usrbin/ at bc cal cancel clear crontab fdformat file find finger gcc head id info less lp/lpr lpstat make man mesg mozilla openssl passwd perl quota scp spell ssh sudo tail tee telnet wc who write xxd
/root.bash_profile.bashrc
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
sbin/ crond cupsd httpd kudzu pppd sendmail sshd traceroute useradd usermod userdel xinetd X11R6/ bin/ startx twm X xclock xinit xsetroot xwd
/varlog/ Bastille/ Assessment/ assessment-report.html dmesg httpd/ access_log error_log spool/ clientmqueue
/procinteruptsioportsmodulessys/ net/ ipv4/ ip_forward
resolv.confsecurettyshadowsysctl.confsysconfig/ network network-scripts/ ifcfg-eth0xinetd.d/ telnet
/lib modules/ 2.4.20-6/ kernel/ drivers/ net/ 3c59x.o
/homersimms/.bash_profile.bashrc
/mntcdrom/floppy/
/optlampp/ bin mysql htdocs phpmyadmin/ index.php sbin/ mysqld
/tmpssh-XXjXuIH9/ agent.13695
/devhdahda1had2tty1
CIS 192 files, directories, commands
/
/etcfstabgrouphostshosts.allowhosts.denyhttpd/ conf/ httpd.conf inittabissuemodules.confmotdmtabpam.d/ loginpasswdprofilerc.d/ rc rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rc.sysinit
/sbinarpbastillechkconfigdebugfsdhclientdmesgdumpe2labelfdiskgrubhaltifconfiginitinsmodiptableslsmodlspcimingettymkfspartprobeportmapquotaonquotaoffrestorermmodrouteserviceshutdowntripwiretune2fs
/binbashcatchgrpchmodchowncpcpiodatedddfdmesgechoenvgrephostnamelnlsmailmkdirmoremountmvnetstatpingpsrmrmdirrpmsleepsortsutartouchumountunamevi
Example GNU/Linux Directory Structure(showing just a few of the many files)
/bootgrub/ grub.confinitrd-2.4.20-6.imgvmlinuz-2.4.20-6
/usrbin/ at bc cal cancel clear crontab fdformat file find finger gcc head id info less lp/lpr lpstat make man mesg mozilla openssl passwd perl quota scp spell ssh sudo tail tee telnet wc who write xxd
/root.bash_profile.bashrc
sbin/ crond cupsd httpd kudzu pppd sendmail sshd traceroute useradd usermod userdel xinetd X11R6/ bin/ startx twm X xclock xinit xsetroot xwd
/varlog/ Bastille/ Assessment/ assessment-report.html dmesg httpd/ access_log error_log spool/ clientmqueue
/procinteruptsioportsmodulessys/ net/ ipv4/ ip_forward
resolv.confsecurettyshadowsysctl.confsysconfig/ network network-scripts/ ifcfg-eth0xinetd.d/ telnet
/lib modules/ 2.4.20-6/ kernel/ drivers/ net/ 3c59x.o
/homersimms/.bash_profile.bashrc
/mntcdrom/floppy/
/optlampp/ bin mysql htdocs phpmyadmin/ index.php sbin/ mysqld
/tmpssh-XXjXuIH9/ agent.13695
/devhdahda1had2tty1
Note: shell builtins = cd, echo, exit, export, history, jobs, kill, pwd, set, type, umask, unset shell keywords = if, then, else, case, for, while
FileTypes
CIS 191 – Lesson 3
File Types and Commands
Note: Other files types includes sockets (s) and named pipes (p)
Long listing code (ls –l)
Type How to make one
d directory mkdir
- regular touch
l symbolic link ln -s
c special (character device files) mknod
b special (block device files, buffered) mknod
CIS 191 – Lesson 3
Various Types of Files (found in /etc)
Directories (blue)
Regular files (black)
Regular files with execute bit set (green)
CIS 191 – Lesson 3
Various Types of Files (found in /bin)
Symbolic links (light blue) with arrow to real file
Rest are regular files with execute bit set (green)
Regular file with setuid bit (red background)
Long listing of files with names starting with s or z
Use file command to show additional file type information
CIS 191 – Lesson 3
Various Types of Files (found in /dev)
Special files (yellow with black background)
Character
Block
CIS 191 – Lesson 3
/boot (Ubuntu 8.04 Desktop)
The kernel (compressed)
Kernel major revision number. Prior to version 2.6, stable releases were even and developmental versions odd
Kernel version number
Kernel minor revision number
Kernel patch number
CIS 191 – Lesson 3
/boot (Red Hat 9)
The kernel (compressed)
The kernel
Symbolic link to kernel
System Installation
• Prepare the Disk
• Select the software
• Install the Boot Loader
Preparing the Disk
• Partitioning– fdisk (command line)– Disk Druid (curses and graphical)
• Formatting– mkfs (command line)
• Assigning Mount Points– /etc/fstab (text file)
Partitioning Schemes
1. One primary partition: / (root)
2. Two partitions: / and swap
3. Three partitions: boot, /, and swap
4. Three partitions: /, swap, and home
5. N partitions: /, swap, home, usr, var, tmp, and boot.
Types of Filesystems
• EXT – Extended File System– ext2, ext3, ext4
• Reiser – R.I.P.• JFS – from IBM• XFS – from SGI• FAT• NTFS• ISO9660
/dev/sda2
/dev/sda5
/dev/sda1
Mounting File Systems/
boot bin etc dev home lib tmp usr var
CIS 191 - Lesson 3
New Commands
and files
CIS 191 - Lesson 3New commands:
df - Show free disk spacedpkg - Show packages (Debian)dmesg - Show kernel boot messagesdu - Show disk usagefdisk - Partition utilityfree - show memoryhostname - Show hostnameifconfig - Show NIC configurationinit - Change runlevelslspci - Show PCI devicesman - Show manual page documentationmount - Show mount pointssu - Switch usersudo - Do command as rootuname - show OS info
New Files and Directories:/etc/password - user accounts/etc/mtab - current mount points/proc/cpuinfo - kernel cpu info
UNIX top level tree directories:/bin, /boot, /dev, /etc, /home, /lib, /proc, /root, /sbin, /tmp, /usr, /var
top related