Root - Mobile ITnT Solutions



4910455-3175009525078105mobile itnTSolutions, LLC.00mobile itnTSolutions, LLC.4572002857500Linux Systems AdministratorProgramClass Notes:“The Linux Directory / File Tree”00Linux Systems AdministratorProgramClass Notes:“The Linux Directory / File Tree”sThe Linux Directory/File Tree – Part I Linux uses the conventional hierarchical directory structure where directories may contain both files and sub-directoriesSub-directories may further hold more files and sub-directoriesSub-directory, also referred to as a child directory, is a directory located under a parent directoryThe Linux directory structure is similar to an inverted tree where the top of the tree is the root of the directory and branches and leaves are sub-directories and files, respectivelyThere are some differences in the filesystems between Linux distributions. .For help about your machine, enter “man hier” to find information about the file system hierarchy. . .this manual will explain the directory structure on your computer.Some of these directories hold static data while others contain dynamic (or variable) informationStatic data refers to file contents that are usually not modifiedNormally contain commands, library routines, kernel files, device files, etc.,Dynamic or variable data refers to file contents that are modified and updated as requiredHold log files, status files, configuration files, temporary files, and so onExplaination of “The Linux Directory/File Tree”: / – RootThe top-level file system in the FHSThe point where the entire file system structure is ultimately connected Only root user has write privilege under this directory.The root of the directory is represented by the forward slash (/) characterThe forward slash character is also used as a directory separator in a path… such as /etc/rc.d/init.d/networkPlease note that /root is root user’s home directory, which is not same as /.Example: ls / /bin – User BinariesContains binary mon linux commands you need to use in single-user modes are located under this mands used by all the users of the system are located here.For example: ps, ls, ping, grep, cp.You can find a /bin subdirectory in many other directories. A user name serena could put her own programs in “ /home/serena/bin ”Example: ls /bin /sbin – System BinariesJust like /bin, /sbin also contains binary executables.But, the linux commands located under this directory are used typically by system administrator, for system maintenance purpose.For example: iptables, reboot, fdisk, ifconfig, swapon/sbin contains binaries to configure the Operating SystemMany of the system binaries require “root” privilege to perform certain tasksExample: ls /sbin /etc – Configuration FilesContains system configuration files required by all programs.This also contains startup and shutdown shell scripts used to start/stop individual programs.For example: # ls /etc/resolv.conf, /etc/logrotate.confReference Attached Sheet about the different files located in “/etc” /dev – Device FilesContains device files/nodes for physical hardware and virtual devices.These include terminal devices, usb, or any device attached to the system.Appear to be ordinary files, but are not actually located on the hard disk. The Linux kernel communicates with these devices through corresponding device nodes located hereExample: ls /dev/sd*, /dev/tty1, /dev/usbmon0 /proc – Process InformationContains information about system process. /proc is another special directory, appearing to be ordinary files, but not taking up disk space. It is actually a view of the kernel, or better, what the kernel manages, and is a means to interact with it directly...Such as CPU, memory, disks, partitioning, file systems, networking, and running processes..This is a pseudo filesystem which contains information about running processes. For example: # ls /proc/{pid} directory contains information about the process with that particular pid.This is a virtual filesystem with text information about system resources. For example: # ls /proc/uptime /var – Variable Filesvar stands for variable files.Content of the files that are expected to grow can be found under this directory.Contains data that frequently changes while the system is operationalFiles holding log, status, spool, lock, and other dynamic data are located hereCommon sub-directories under “/var” … /var/log:Storage for most system log files like:system logsboot logsfailed user logsuser logsinstallation logscron logsmail logsetc…/var/opt:Additional software installed inStores log, status, and other variable data files for that software/var/spool:Directories that hold print jobs, cron jobs, mail messages, and other queued items before being sent out/var/tmp:Large temporary files Temporary files that need to exist for longer periods of time than what is allowed in /tmpThese files survive system reboots and are not automatically deleted /tmp – Temporary FilesDirectory that contains temporary files created by system and users.Files under this directory are deleted when system is rebooted.Never use /tmp to store data that is important or which you wish to archiveExample: # ls /tmp /usr – User Programs“usr” stands for Unix System ResourcesContains general files related to the systemContains binaries, libraries, documentation, and source-code for second level programs.Sub-directories under /usr:/usr/bin:contains binary files for user programs. Contains crucial executable user executable commandsIf you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp/usr/sbin:Most commands required at system boot are located here as well as commands requiring root privileges to runcontains crucial sys admin commands not intended for execution by regular users.If you can’t find a system binary under /sbin, look under /usr/sbin.For example: atd, cron, sshd, useradd, userdel/usr/lib:contains shared library routines required by many commands and programs located in /usr/bin and /usr/sbin directories, as well as by the kernel and other programs/usr/local:This directory serves as a sys admin repository for storing commands and tools downloaded from the web, developed in-house, or obtained elsewhere/usr/src:Used to store source code/usr/include:Contains header files for C language/usr/share:Location for man pages, documentation, sample templates, configuration files, etc… that may be shared on multi-vendor Linux platforms /home – Home DirectoriesHome directories for all users to store their personal files.It is common practice (but not mandatory) to name the users home directory after the user name in the format “ /home/$USERNAME ” For example: # ls /home/john, /home/nikita /boot – Boot Loader FilesContains boot support and configuration files.All Files needed to boot the computerKernel initrd, vmlinux, grub files are located under /bootFor example: # ls /boot /lib – System LibrariesContains library files that supports the binaries located under /bin and /sbinLibrary filenames are either ld* or lib*.so.*For example: # ls /lib /opt – Optional add-on Applicationsopt stands for optional.The purpose of /opt is to store additional software. In many cases this is software from outside the distribution repository.. You may find an empty /opt directory on many systems.Contains add-on applications from individual vendors.add-on applications should be installed under either /opt/ or /opt/ sub-directory.A Large package can install all its files in /bin, /lib, /etc subdirectories within /opt/$packagename/ /mnt – Mount DirectoryTemporary mount directory where sysadmins can mount filesystems.Should be empty and only used for temporary mount points /media – Removable Media DevicesTemporary mount directory for removable media, such as floppy, CD, DVD, USB, and Zip drives.For examples: # ls /media/ cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writerSince /media is rather new in the Unix world, you could very well encounter systems running without this directory. Most Linux distributions today mount all removable media in /media /srv – Service Datasrv stands for service.You may use /srv for data that is served by your systemThe FHS allows locating cvs, rsync, ftp and www data in this locationFor example: # ls /srv/sys - System File SystemInfo about configured hotplug hardware devices is stored and maintained in the "/sys" file systemThis info is referenced for loading kernel modules, creating device nodes in the "/dev" directory, and configuring each device.This file system is auto maintained as well.Assignments: Internal Exercise Questions:Request from Instructor when you have completed the video and Internal ExerciseExercise(s):No ExerciseLab(s):No LabInternal Exercise: Yes ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download