1 / 86

SUSE Linux Enterprise Desktop Administration

SUSE Linux Enterprise Desktop Administration. Chapter 7 Manage Directories and Files. Objectives. Objective 1—Understand the File System Hierarchy Standard (FHS) Objective 2—Identify File Types in the Linux System Objective 3—Change Directories and List Directory Contents.

heins
Download Presentation

SUSE Linux Enterprise Desktop Administration

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SUSE Linux Enterprise Desktop Administration Chapter 7 Manage Directories and Files

  2. Objectives • Objective 1—Understand the File System Hierarchy Standard (FHS) • Objective 2—Identify File Types in the Linux System • Objective 3—Change Directories and List Directory Contents SUSE Linux Enterprise Desktop Administration

  3. Objectives (continued) • Objective 4—Create and View Files • Objective 5—Work with Files and Directories • Objective 6—Find Files on Linux SUSE Linux Enterprise Desktop Administration

  4. Objective 1—Understand the File System Hierarchy Standard (FHS) • The file system concept of Linux is considerably different than that of other operating systems • A filename in Linux can be up to 255 characters long • Can contain any number of special characters • You can also use umlauts, letters with diacritical marks, or other country-specific characters • Linux differentiates between uppercase and lowercase letters SUSE Linux Enterprise Desktop Administration

  5. The Hierarchical Structure of the File System • Linux file system involves a hierarchical file system that can be depicted in the form of a tree • Tree is not limited to a local partition • Can stretch over several partitions, which can be located on different computers in a network • Begins at the root • A file in the tree is uniquely defined by its path • Path refers to the directory names that lead to a file • Relative path • Absolute path SUSE Linux Enterprise Desktop Administration

  6. The Hierarchical Structure of the File System (continued) Figure 7-1 Linux hierarchical file system SUSE Linux Enterprise Desktop Administration

  7. The Hierarchical Structure of the File System (continued) • The absolute path always begins with a slash (‘‘/’’), the symbol for the root directory • You can change directories with the cd command • Using both absolute and relative paths SUSE Linux Enterprise Desktop Administration

  8. FHS (Filesystem Hierarchy Standard) • The structure of the file system is described in the Filesystem Hierarchy Standard (FHS) • Specifies which directories must be located on the first level after the root directory and what they contain • The FHS defines a two-layered hierarchy: • The directories in the top layer (immediately below the root directory ‘‘/’’) • As a second layer, the directories under /usr and /var SUSE Linux Enterprise Desktop Administration

  9. Root Directory (/) • The root directory refers to the highest layer of the file system tree • Normally only directories (not files) are located here • When the system is booted, the partition on which this directory is located is the first one mounted • The following directories always have to be on the same partition as the root directory: • /bin, /dev, /etc, /lib, and /sbin SUSE Linux Enterprise Desktop Administration

  10. Essential Binaries for Use by All Users (/bin) • /bin contains executable programs that are required when no other file systems are mounted Table 7-1 Some of the programs in the /bin directory SUSE Linux Enterprise Desktop Administration

  11. Boot Directory (/boot) • Contains static files of the boot loader GRUB • The backed-up information for the Master Boot Record (MBR) and the system map files are also stored here • Also contains the kernel that has the filename vmlinuz SUSE Linux Enterprise Desktop Administration

  12. Other Partitions (/data) • If YaST finds other (non-Windows) partitions or another hard disk during the installation • Creates mountpoints for each partition labeled: • /data1 • /data2 • /dataX SUSE Linux Enterprise Desktop Administration

  13. Device Files (/dev) • Each hardware component existing in the system is represented as a file in the /dev directory • Two kinds of device files are included: • Character-oriented device files • Block-oriented device files • Major device numbers • Connection to device drivers in the kernel is implemented via numbered channels • Corresponding to the number of the device driver in question SUSE Linux Enterprise Desktop Administration

  14. Device Files (/dev) (continued) • A driver might be responsible for several devices of the same type • To distinguish between these devices, the minor device number is used • Most device files are created dynamically by udev in /dev • When the corresponding hardware is detected during the boot process • The null device /dev/null is also located in this directory SUSE Linux Enterprise Desktop Administration

  15. Table 7-2 Some important device files SUSE Linux Enterprise Desktop Administration

  16. Configuration Files (/etc) • The /etc directory and its subdirectories contain system configuration files • Almost all of them can be processed with any editor • Normal users can read nearly all of these files, but they cannot edit any of them • According to the FHS, no executable programs can be located here • Subdirectories contain many shell scripts SUSE Linux Enterprise Desktop Administration

  17. Table 7-3 Some important configuration files SUSE Linux Enterprise Desktop Administration

  18. User Directories (/home) • Home directory • Every user on a Linux system has his or her own area in which to work with files • Individual configuration files can be found in the user’s home directory • These configuration files are hidden files • All these files have names that begin with a dot • The home directory of a user can also be addressed via the shortcut “~” SUSE Linux Enterprise Desktop Administration

  19. Table 7-4 Some important files in a user’s home directory SUSE Linux Enterprise Desktop Administration

  20. Libraries (/lib) • Many programs use specific functions that are also used by other programs • Functions are removed from the actual program, stored in the system, and only called up when the program runs • Called shared libraries • The /lib directory contains the libraries that are used by programs in the /bin and /sbin directories • The kernel modules are located in the /lib/modules/ directory • Find additional libraries below the directory /usr SUSE Linux Enterprise Desktop Administration

  21. Mountpoints for Removable Media (media/*) • SUSE Linux creates directories in the /media/ directory for removable media it detects: • /media/floppy/—Created for a floppy disk drive • /media/cdrom/—Created for a CD-ROM drive • /media/cdrecorder—Created for a CD burner • /media/dvd—Created for a DVD drive • /media/usbdisk/—Created for a USB stick • /media/medianame—Created after inserting a labeled removable media SUSE Linux Enterprise Desktop Administration

  22. Application Directory (/opt) • Installed programs can store their static files in the /opt directory • First, a directory with the name of the application is created • The files are then stored in that directory • Examples include GNOME (/opt/gnome) and KDE (/opt/kde3) SUSE Linux Enterprise Desktop Administration

  23. Home Directory of the Administrator (/root) • The home directory of the system administrator should be on the same partition as the root directory, ‘‘/’’ • Only then is it guaranteed that the user root can: • Always log in without a problem • Have his or her own configured environment available SUSE Linux Enterprise Desktop Administration

  24. System Binaries (/sbin) • The /sbin directory contains important programs for system administration • Programs that are run by normal users are also located in /bin • Programs in the /sbin directory can also, as a rule, be run by normal users • But only to display the configured values • Changes to the configuration can only be made by the user root SUSE Linux Enterprise Desktop Administration

  25. System Binaries (/sbin) (continued) Table 7-5 An overview of important files in the /sbin directory SUSE Linux Enterprise Desktop Administration

  26. Data Directories for Services (/srv) • The subdirectories of the /srv directory contain data of various services • Examples: • The files of the Apache Web server are located in the /srv/www/ directory • The FTP server files are located in the /srv/ftp/ directory SUSE Linux Enterprise Desktop Administration

  27. Temporary Area (/tmp) • Various programs create temporary files that are stored in /tmp until they are deleted SUSE Linux Enterprise Desktop Administration

  28. The Hierarchy Below /usr • The /usr directory, in accordance with the FHS, represents a second hierarchical layer • This is the location for all application programs, graphical interface files, additional libraries, locally installed programs, and commonly shared directories containing documentation SUSE Linux Enterprise Desktop Administration

  29. The Hierarchy Below /usr (continued) Figure 7-6 Some of the important files in the /usr directory SUSE Linux Enterprise Desktop Administration

  30. Variable Files (/var) • The /var directory and its subdirectories contain files that can be modified while the system is running Figure 7-7 Some of the most important directories beneath /var SUSE Linux Enterprise Desktop Administration

  31. Windows Partitions (/windows) • If YaST finds any partitions with a Microsoft file system, it automatically creates a /windows directory • Inside this directory: subdirectories labeled with Windows drive characters SUSE Linux Enterprise Desktop Administration

  32. Process Files (/proc) • Linux handles process information that is made available to users via the /proc directory • The /proc directory is generated dynamically when it is accessed • Contains files and directories • Each process has its own directory • /proc also includes directories and files containing information about the state of the system SUSE Linux Enterprise Desktop Administration

  33. Process Files (/proc) (continued) Figure 7-8 Some of the important files in the /proc directory SUSE Linux Enterprise Desktop Administration

  34. System Information Directory (/sys) • The /sys directory provides information, in the form of a tree structure, on various hardware buses, hardware devices, active devices, and their drivers • Like the /proc directory, /sys is generated dynamically when it is accessed SUSE Linux Enterprise Desktop Administration

  35. Mountpoint for Temporarily Mounted File Systems (/mnt) • The standard directory for integrating file systems is /mnt • Should only be used for temporary purposes • For permanent mounts, you should create an appropriately named directory • Mount hard drive partitions using the mount command • To remove a partition, use the umount command • If the file system format is not supported by the kernel, the command is aborted SUSE Linux Enterprise Desktop Administration

  36. Directories for Mounting Other File Systems • A directory must exist at the point where you intend to mount the file system • Referred to as the mount point • In most cases, only the user root can mount and unmount directories • Removable media can be changed by a normal user • The file /etc/mtab shows which file systems are currently mounted • You can also share certain directories with many computers SUSE Linux Enterprise Desktop Administration

  37. Directories for Mounting Other File Systems (continued) Table 7-9 Directories that can be shared Table 7-10 Directories that cannot be imported from other computers SUSE Linux Enterprise Desktop Administration

  38. Exercise 7-1: Explore the SUSE Linux File System Hierarchy • In this exercise, describe what directories the characters / and ~ refer to • Then, find out the mount point of the DVD • Mount the DVD manually at another position (/mnt) in the file system SUSE Linux Enterprise Desktop Administration

  39. Objective 2—Identify File Types in the Linux System • Available file types: • Normal Files • Directories • Device Files • Links • Sockets • FIFOs SUSE Linux Enterprise Desktop Administration

  40. Normal Files • Refer to files as they are also known in other operating systems: • Sets of contiguous data addressed with one name • The names for such files can be freely chosen and there is no division into filename and file type SUSE Linux Enterprise Desktop Administration

  41. Directories • Directories are used to organize files and directories into groups • Directories contain two entries with which the structure of the hierarchical file system is implemented • One of these entries (‘‘.’’) points to the directory itself • The other entry (‘‘..’’) points to the entry one level higher in the hierarchy SUSE Linux Enterprise Desktop Administration

  42. Device Files • Each piece of hardware in a Linux system is represented by a device file • With the exception of network cards • Every program that wants to access hardware must access it through the corresponding device file • The programs write to or read from a device file • The kernel then ensures that the data finds its way to the hardware or can be read from the file SUSE Linux Enterprise Desktop Administration

  43. Links • Links are references to files located at other points in the file system • Data maintenance is simplified through the use of such links • Changes only need to be made to the original file • The changes are then automatically valid for all links SUSE Linux Enterprise Desktop Administration

  44. Sockets • A socket refers to a special file in the file system • Implements data exchange between two locally running processes SUSE Linux Enterprise Desktop Administration

  45. FIFOs • FIFO (First In First Out) or ‘‘named pipe’’ • Files that are used to exchange data between processes • A FIFO file can only exchange data in one direction SUSE Linux Enterprise Desktop Administration

  46. Objective 3—Change Directories and List Directory Contents • You can use the following commands to change the active directory and list the contents of a directory: • cd • ls • pwd SUSE Linux Enterprise Desktop Administration

  47. cd • You can use the cd (change directory) command to change between directories Table 7-11 Examples of the cdcommand SUSE Linux Enterprise Desktop Administration

  48. ls • The ls (list) command lists the specified files Table 7-12 The most important options of the lscommand SUSE Linux Enterprise Desktop Administration

  49. pwd • You can use the pwd (print working directory) command to display the path of the current directory • If you enter pwd with the -P option, pwd prints the physical directory without any symbolic links SUSE Linux Enterprise Desktop Administration

  50. Exercise 7-2: Change Directories and List Directory Contents • In this exercise, describe what directories the characters . and .. refer to • Then, change between directories (cd), display the name of the active directory (pwd), and list directory contents (ls) SUSE Linux Enterprise Desktop Administration

More Related