Figure7-3.Hard and symbolic links

Name Finding links to a file Finding the file pointed to by a symbolic link is simple. The ls -l ls -l command displays a convenient pointer notation, indicating just where links are pointing: command displays a convenient pointer notation, indicating just where links are pointing: lrwxrwxrwx1rootroot19Jan402:43file1->/file1 Going the other way and finding symbolic links to a file is less obvious but is still relatively easy. The -lname -lname option to the option to the find find utility locates them for you by searching for symbolic links containing the original filename. Here, the entire local filesystem is searched for utility locates them for you by searching for symbolic links containing the original filename. Here, the entire local filesystem is searched for myfile myfile, turning up three symbolic links: #find/-lnamemyfile /home/world/rootsfile /home/finance/hisfile /root/myslink Remember that symbolic links could be anywhere, which includes a remote system (if you"re sharing files), so you may not be able to locate them all. (See Objective 3: Perform Basic File Management Objective 3: Perform Basic File Management, for additional information on the find find command). command).

Since hard links aren"t really links but duplicate directory entries, you can locate them by searching directory entries for the inode, which is identical in all the links. Unlike symbolic links, you are guaranteed to find all of the links since hard links cannot cross filesystem boundaries. First, identify the inode you"re interested in, as well as the filesystem that contains the links: #dffile1 Filesystem1k-blocksUsedAvailableUse%Mountedon /dev/sda91981000451115142747324%/home #ls-ifile 90469file1file1isonthe/homefilesystem,anditsinode numberis90469.Next,findisusedwiththe-inum optiontolocateallinstancesofinode90469: #find/home-inum90469 /home/world/file1 /home/finance/file1 /home/jdoe/private/.myfile1 This example turns up three links to file1 file1, including one that user jdoe jdoe appears to be hiding! appears to be hiding!

On the ExamYou should be prepared to identify the differences between hard and symbolic links, when each is used, and their limitations.

Objective 7: Find System Files and Place Files in the Correct Location In 1993, the Linux community formed a project to provide a standardized filesystem layout for all general-purpose distributions of Linux. The intent of this standardization was to provide advice on how to reduce the proliferation of proprietary Linux filesystem layouts and their possible contribution to market fragmentation.

The project released a doc.u.ment describing the Linux Filesystem Standard, usually abbreviated FSSTND, in 1994. The following year, the group began to reduce Linux-specific content and to refine the standard to include other Unix or Unix-like operating systems. As the FSSTND attracted broader appeal, it was renamed the Filesystem Hierarchy Standard Filesystem Hierarchy Standard. Although the FHS is not a requirement of Linux developers and distributors, the Linux community understands the importance of standards, and all major distributions support the standard.

NoteThe full FHS specification is available at The information in this chapter is consistent with version 2.3 of the specification.

Datatypes To frame its recommendations, the FHS defines two categories of data use, each with two opposing subtypes: Data sharing This category defines the scope of data use in a networked environment:SharableSharable data can be used by multiple host systems on a network. Sharable files contain general-purpose information, without ties to any specific host. Examples include user data files, executable program files, and system doc.u.mentation.NonsharableData is not sharable when linked to a specific host, such as a unique configuration file.

Data modification This category specifies how data changes:VariableData is considered variable when changed by natural, frequent processes. Examples include user files and system logfiles, such as /var/log/messages /var/log/messages.StaticStatic data is left alone for the most part, remaining the same from day to day or even year to year. Examples include binary programs such as ls ls and and bash bash, which change only when the system administrator performs an upgrade.

Some directories in the Linux filesystem are intended to hold specific types of data. For example, the executable files in /usr /usr are rarely changed, and thus could be defined as are rarely changed, and thus could be defined as static static because they are needed by all users on a network. Before disks were as large as they are today, the files commonly found in because they are needed by all users on a network. Before disks were as large as they are today, the files commonly found in /usr /usr were often mounted from remote servers to preserve local disk s.p.a.ce. Thus, in addition to being static, were often mounted from remote servers to preserve local disk s.p.a.ce. Thus, in addition to being static, /usr /usr is said to be is said to be sharable sharable. Keeping files organized with respect to these attributes can simplify file sharing, system administration, and backup complexity, as well as reduce storage requirements. The FHS arranges the preceding data categories into a 2 2 matrix, as shown with a few example directories in Table7-6 Table7-6.

Table7-6.FHS datatypes

Sharable Nonsharable Static /usr /usr/local /etc /boot Variable /var/mail /home /var/log /proc

On many networks, /usr /usr and and /usr/local /usr/local are mounted by individual workstations from an NFS server. This can save a considerable amount of local storage on the workstations. More importantly, placing these directories on another system can make upgrades and additions much simpler. These directories are usually shared as read-only filesystems because they are never modified by most end users. The are mounted by individual workstations from an NFS server. This can save a considerable amount of local storage on the workstations. More importantly, placing these directories on another system can make upgrades and additions much simpler. These directories are usually shared as read-only filesystems because they are never modified by most end users. The /var/mail /var/mail and and /home /home directories, on the other hand, are shared but must be changed regularly by users. The directories, on the other hand, are shared but must be changed regularly by users. The /etc /etc and and /boot /boot directories contain files that are static in the sense that only the administrator changes them, but sharing them is not necessary or advised, because they are local configuration files. The directories contain files that are static in the sense that only the administrator changes them, but sharing them is not necessary or advised, because they are local configuration files. The /var/log /var/log and and /proc /proc directories are very dynamic but also of local interest only. directories are very dynamic but also of local interest only.

The root Filesystem The FHS offers a significant level of detail describing the exact locations of files, using rationale derived from the static/variable and sharable/nonsharable definitions. However, knowledge of the location of every file is not necessary or required for Exam 101. This section discusses the major portions of the FHS directory hierarchy overall, with specific example files offered as ill.u.s.trations.

NoteAlthough the FHS is a defining doc.u.ment for the Linux filesystem, it does not follow that all directories described in the FHS will be present in all Linux installations. Some directory locations cited in the FHS are package-dependent or open to customization by the vendor.

The root filesystem is located at the top of the entire directory hierarchy. The FHS defines these goals for the root filesystem: It must contain utilities and files sufficient to boot the operating system, including the ability to mount other filesystems. This includes utilities, device files, configuration, boot loader information, and other essential start-up data.

It should contain the utilities needed by the system administrator to repair or restore a damaged system.

It should be relatively small. Small part.i.tions are less likely to be corrupted due to a system crash or power failure than large ones are. In addition, the root part.i.tion should contain nonsharable data to maximize the remaining disk s.p.a.ce for sharable data.

Software should not create files or directories in the root filesystem.

Although a Linux system with everything in a single root part.i.tion may be created, doing so would not meet these goals. Instead, the root filesystem should contain only essential system directories, along with mount points for other filesystems. Essential root filesystem directories include: /bin The /bin /bin directory contains executable system commands such as directory contains executable system commands such as cp, date, ln, ls, mkdir cp, date, ln, ls, mkdir, and more more. These commands are deemed essential to system administration in case of a problem.

/dev Device files, necessary for accessing disks and other devices, are stored in /dev. Examples include disk part.i.tions, such as hda1 hda1, and terminals, such as tty1 tty1. Devices must be present at boot time for proper mounting and configuration. The exception to this rule is systems using devfs devfs, which is a relatively recent addition to the Linux kernel that makes /dev /dev a virtual filesystem, much like a virtual filesystem, much like /proc /proc, where device-special files are created by the kernel when drivers register devices. Use of devfs devfs is currently not covered by the Level 1 Objectives. is currently not covered by the Level 1 Objectives.

/etc The /etc /etc directory contains configuration information unique to the system and is required for boot time. No binary executable programs are stored here. Prior practice in various versions of Unix had administrative executable programs stored in directory contains configuration information unique to the system and is required for boot time. No binary executable programs are stored here. Prior practice in various versions of Unix had administrative executable programs stored in /etc /etc. These have been moved to /sbin /sbin under the FHS. Example files include under the FHS. Example files include pa.s.swd, hosts pa.s.swd, hosts, and login.defs login.defs.

/lib The /lib /lib directory contains shared libraries and kernel modules, both essential for system initialization. directory contains shared libraries and kernel modules, both essential for system initialization.

/mnt This directory is provided for the local system administrator"s use. Generally, it is empty except for some mount points for temporary part.i.tions, including cdrom cdrom and and floppy floppy.

/root The recommended default (but optional) home directory for the superuser is /root /root. Although it is not absolutely essential for /root /root to be on the root filesystem, it is customary and convenient, because doing so keeps root"s configuration files available for system maintenance or recovery. to be on the root filesystem, it is customary and convenient, because doing so keeps root"s configuration files available for system maintenance or recovery.

/sbin Essential utilities used for system administration are stored in /sbin /sbin. Examples include fdisk, fsck fdisk, fsck, and mkfs mkfs.

The remaining top-level directories in the root filesystem are considered nonessential for emergency procedures: /boot The /boot /boot directory contains files for the boot loader (such as LILO or GRUB). Because it is typically small, it can be left in the root filesystem. However, it is often separated to keep the boot loader files within the first 1,024 cylinders of a physical disk. directory contains files for the boot loader (such as LILO or GRUB). Because it is typically small, it can be left in the root filesystem. However, it is often separated to keep the boot loader files within the first 1,024 cylinders of a physical disk.

/home The /home /home filesystem contains home directories for system users. This is usually a separate filesystem and is often the largest variable filesystem in the hierarchy. filesystem contains home directories for system users. This is usually a separate filesystem and is often the largest variable filesystem in the hierarchy.

/opt The /opt /opt directory is intended for the installation of software other than that packaged with the operating system. This is often the location selected by third-party software vendors for their products. directory is intended for the installation of software other than that packaged with the operating system. This is often the location selected by third-party software vendors for their products.

/tmp The /tmp /tmp directory is for the storage of temporary files. The FHS recommends (but does not require) that its contents are deleted upon every system boot. directory is for the storage of temporary files. The FHS recommends (but does not require) that its contents are deleted upon every system boot.

/usr The /usr /usr filesystem contains a significant hierarchy of executable programs deemed nonessential for emergency procedures. It is usually contained in a separate part.i.tion. It contains sharable, read-only data, and is often mounted locally read-only and shared via NFS read-only. filesystem contains a significant hierarchy of executable programs deemed nonessential for emergency procedures. It is usually contained in a separate part.i.tion. It contains sharable, read-only data, and is often mounted locally read-only and shared via NFS read-only. /usr /usr is described in detail in the next section. is described in detail in the next section.

/var Like /usr /usr, the /var /var filesystem contains a large hierarchy and is usually contained in a separate part.i.tion. It holds data that varies over time, such as logs, mail, and spools. filesystem contains a large hierarchy and is usually contained in a separate part.i.tion. It holds data that varies over time, such as logs, mail, and spools.

The /usr filesystem The /usr /usr filesystem hierarchy contains system utilities and programs that do not appear in the root part.i.tion. For example, user programs such as filesystem hierarchy contains system utilities and programs that do not appear in the root part.i.tion. For example, user programs such as less less and and tail tail are found in are found in /usr/bin. /usr/sbin /usr/bin. /usr/sbin contains system administration commands such as contains system administration commands such as adduser adduser and and traceroute traceroute, and a number of daemons needed only on a normally operating system. No host-specific or variable data is stored in /usr /usr. Also disallowed is the placement of directories directly under /usr /usr for large software packages. An exception to this rule is made for X11, which has a strong precedent for this location. for large software packages. An exception to this rule is made for X11, which has a strong precedent for this location.

The following subdirectories may be found under /usr /usr: /usr/X11R6 This directory contains files for XFree86. Because X is deployed directly under /usr on many Unix systems, X breaks the rule that usually prohibits a custom /usr directory for a software package.

/usr/bin The /usr/bin /usr/bin directory is the primary location for user commands that are not considered essential for emergency system maintenance (and thus are stored here rather than in directory is the primary location for user commands that are not considered essential for emergency system maintenance (and thus are stored here rather than in /bin /bin).

/usr/include /usr/include is the standard location for is the standard location for include include or or header header files, used for C and C++ programming. files, used for C and C++ programming.

/usr/lib This directory contains shared libraries that support various programs. FHS also allows the creation of software-specific directories here. For example, /usr/lib/perl5 /usr/lib/perl5 contains the standard library of Perl modules that implement programming functions in that language. contains the standard library of Perl modules that implement programming functions in that language.

/usr/local /usr/local is the top level of another hierarchy of binary files, intended for use by the system administrator. It contains subdirectories much like is the top level of another hierarchy of binary files, intended for use by the system administrator. It contains subdirectories much like /usr /usr itself, such as itself, such as /bin, /include, /lib /bin, /include, /lib, and /sbin /sbin. After a fresh Linux installation, this directory contains no files but may contain an empty directory hierarchy. Example items that may be found here are locally created doc.u.ments in /usr/local/doc /usr/local/doc or or /usr/local/man /usr/local/man, and executable scripts and binary utilities provided by the system administrator in /usr/local/bin /usr/local/bin.

/usr/sbin The /usr/sbin /usr/sbin directory is the primary location for system administration commands that are not considered essential for emergency system maintenance (and thus are stored here rather than in directory is the primary location for system administration commands that are not considered essential for emergency system maintenance (and thus are stored here rather than in /sbin /sbin).

/usr/share /usr/share contains a hierarchy of datafiles that are independent of, and thus can be shared among, various hardware architectures and operating system versions. This is in sharp contrast to architecture-dependent files such as those in contains a hierarchy of datafiles that are independent of, and thus can be shared among, various hardware architectures and operating system versions. This is in sharp contrast to architecture-dependent files such as those in /usr/bin /usr/bin. For example, in an enterprise that uses both i386- and Alpha-based Linux systems, /usr/share /usr/share could be offered to all systems via NFS. However, since the two processors are not binary-compatible, could be offered to all systems via NFS. However, since the two processors are not binary-compatible, /usr/bin /usr/bin would have two NFS shares, one for each architecture. would have two NFS shares, one for each architecture.The information stored in /usr/share /usr/share is static data, such as the GNU is static data, such as the GNU info info system files, dictionary files, and support files for software packages. system files, dictionary files, and support files for software packages.

/usr/src /usr/src is an optional directory on all modern glibc-based systems. On older libc4- and libc5-based systems, is an optional directory on all modern glibc-based systems. On older libc4- and libc5-based systems, /usr/src/linux /usr/src/linux was expected to contain a copy of the kernel source, or at least the directories was expected to contain a copy of the kernel source, or at least the directories include/asm include/asm and and include/linux include/linux for kernel header files. for kernel header files.On glibc-based systems, nothing should refer to the /usr/src/linux /usr/src/linux directory. In fact, leaving kernel source at that location is generally regarded as a bad practice, since it has the potential to confuse old software. directory. In fact, leaving kernel source at that location is generally regarded as a bad practice, since it has the potential to confuse old software.

The /var filesystem The /var /var filesystem contains data such as printer spools and logfiles that vary over time. Since variable data is always changing and growing, filesystem contains data such as printer spools and logfiles that vary over time. Since variable data is always changing and growing, /var /var is usually contained in a separate part.i.tion to prevent the root part.i.tion from filling. The following subdirectories can be found under is usually contained in a separate part.i.tion to prevent the root part.i.tion from filling. The following subdirectories can be found under /var /var: /var/account Some systems maintain process accounting data in this directory.

/var/cache /var/cache is intended for use by programs for the temporary storage of intermediate data, such as the results of lengthy computations. Programs using this directory must be capable of regenerating the cached information at any time, which allows the system administrator to delete files as needed. Because it holds transient data, is intended for use by programs for the temporary storage of intermediate data, such as the results of lengthy computations. Programs using this directory must be capable of regenerating the cached information at any time, which allows the system administrator to delete files as needed. Because it holds transient data, /var/cache /var/cache never has to be backed up. never has to be backed up.

/var/crash This optional directory holds crash dumps for systems that support that feature.

/var/games This optional directory is used to store state information, user score data, and other transient items.

/var/lock Lock files, used by applications to signal their existence to other processes, are stored here. Lock files usually contain no data.

/var/log The /var/log /var/log directory is the main repository for system logfiles, such as those created by the syslog system. For example, the default system logfile is directory is the main repository for system logfiles, such as those created by the syslog system. For example, the default system logfile is /var/log/messages /var/log/messages.

/var/mail This is the system mailbox, with mail files for each user. /var/mail /var/mail is a replacement for is a replacement for /var/spool/mail /var/spool/mail and aligns FHS with many other Unix implementations. You may find that your Linux distribution still uses and aligns FHS with many other Unix implementations. You may find that your Linux distribution still uses /var/spool/mail /var/spool/mail.

/var/opt This directory is defined as a location for temporary files of programs stored in /opt /opt.

/var/run /var/run contains various files describing the present state of the system. All such files may be deleted at system boot time. This is the default location for PID files, which contain the PIDs of the processes for which they are named. For example, if the Apache web server, contains various files describing the present state of the system. All such files may be deleted at system boot time. This is the default location for PID files, which contain the PIDs of the processes for which they are named. For example, if the Apache web server, httpd httpd, is running as process number 534, /var/run/httpd.pid /var/run/httpd.pid will contain that number: will contain that number:#cat/var/run/httpd.pid 534Such files are needed by utilities that must be able to find a PID for a running process. Also located here is the utmp utmp file, used by commands such as file, used by commands such as who who and and last last to display logged-in users. to display logged-in users.

/var/spool The /var/spool /var/spool directory contains information that is queued for processing. Examples include print queues, outgoing mail, and directory contains information that is queued for processing. Examples include print queues, outgoing mail, and crontab crontab files. files.

/var/state The /var/state /var/state directory is intended to contain information that helps applications preserve state across multiple invocations or multiple instances. directory is intended to contain information that helps applications preserve state across multiple invocations or multiple instances.

/var/tmp As with /tmp /tmp in the root filesystem, in the root filesystem, /var/tmp /var/tmp is used for storage of temporary files. Unlike is used for storage of temporary files. Unlike /tmp /tmp, the files in /var/tmp /var/tmp are expected to survive across multiple system boots. The information found in are expected to survive across multiple system boots. The information found in /var/tmp /var/tmp could be considered more persistent than information in could be considered more persistent than information in /tmp /tmp.Although it is not specified this way in the FHS, some distributions use /var/tmp /var/tmp as a more secure temporary directory for use by as a more secure temporary directory for use by root root.

/var/yp This optional directory contains the database files of the Network Information Service (NIS), if implemented. NIS was formerly known as yellow pages yellow pages (not to be confused with the big yellow book). (not to be confused with the big yellow book).This directory shouldn"t be confused with /var/nis /var/nis, which is used by NIS+. Oddly, /var/nis /var/nis is mentioned in a footnote in FHS 2.3, but it does not have an entry in the specification. is mentioned in a footnote in FHS 2.3, but it does not have an entry in the specification.

Linux annex Since FHS migrated away from being a Linux-only doc.u.ment and expanded to cover other operating systems, information specific to any one operating system was moved to an annex annex. The only annex listed in v2.3 of FHS is the Linux annex, which mentions a few guidelines and makes allowances for the placement of additional program files in /sbin /sbin. The Linux annex also mentions and supports the use of the /proc /proc filesystem for the processing of kernel, memory, and process information. filesystem for the processing of kernel, memory, and process information.

Where"s that binary?

Compiled executable files, called binary files binary files, or just binaries binaries, can be located in a number of places in an FHS-compliant filesystem. However, it"s easy to become a little confused over why a particular executable file is placed where it is in the FHS. This is particularly true for bin bin and and sbin sbin directories, which appear in multiple locations. directories, which appear in multiple locations. Table7-7 Table7-7 lists these directories and shows how each is used. lists these directories and shows how each is used.

Table7-7.Binary file locations

Type of file User commands System administration commands Vendor-supplied, essential (root filesystem) /bin /sbin Vendor-supplied, nonessential (/usr filesystem) filesystem) /usr/bin /usr/sbin Locally supplied, nonessential (/usr filesystem) filesystem) /usr/local/bin /usr/local/sbin

Locating Files FHS offers the Linux community an excellent resource that a.s.sures consistency across distributions and other operating systems. In practice, however, file location problems can be frustrating, and the need arises to find files in the system quickly. These file location tools are required for Exam 101: which, find, locate, whereis which, find, locate, whereis, and type type.

which uses the uses the PATH PATH variable to locate executable files. variable to locate executable files. find find searches specified areas in the filesystem. searches specified areas in the filesystem. whereis whereis searches in a small subset of common directories. searches in a small subset of common directories. locate locate offers a quick alternative to offers a quick alternative to find find for filename searches and is suited for locating files that are not moved around in the filesystem. Without a fresh database to search, for filename searches and is suited for locating files that are not moved around in the filesystem. Without a fresh database to search, locate locate is not suitable for files recently created or renamed. is not suitable for files recently created or renamed.

Name which Syntax whichcommand Description Determine the location of command command and display the full pathname of the executable program that the sh.e.l.l would launch to execute it. and display the full pathname of the executable program that the sh.e.l.l would launch to execute it. which which searches only the user"s path. searches only the user"s path.

Example Determine the sh.e.l.l that would be started by entering the tcsh tcsh command: command: #whichtcsh /bin/tcsh which is small and does only one thing: determines what executable program will be found and called by the sh.e.l.l. Such a search is particularly useful if you"re having trouble with the setup of your is small and does only one thing: determines what executable program will be found and called by the sh.e.l.l. Such a search is particularly useful if you"re having trouble with the setup of your PATH PATH environment variable or if you are creating a new version of an existing utility and want to be certain you"re executing the experimental version. environment variable or if you are creating a new version of an existing utility and want to be certain you"re executing the experimental version.

Name find Syntax findpaths.e.xpression Description Locate files that match an expression expression starting at starting at paths paths and continuing recursively. The and continuing recursively. The find find command has a rich set of command has a rich set of expression expression directives for locating just about anything in the filesystem. directives for locating just about anything in the filesystem.

Example To find files by name located in the /usr /usr directory hierarchy that might have something to do with the directory hierarchy that might have something to do with the csh csh sh.e.l.l or its variants, you might use the sh.e.l.l or its variants, you might use the -name -name filename filename directive: directive: #find/usr-name"*csh*"

/usr/bin/sun-message.csh /usr/doc/tcsh-6.08.00 /usr/doc/tcsh-6.08.00/complete.tcsh /usr/doc/vim-common-5.3/syntax/csh.vim /usr/man/man1/tcsh.1 /usr/share/apps/ktop/pics/csh.xpm /usr/share/apps/ktop/pics/tcsh.xpm /usr/share/emacs/20.3/etc/emacs.csh /usr/share/vim/syntax/csh.vim /usr/src/linux-2.2.5/fs/lockd/svcshare.c Some of these results are clearly related to csh csh or to or to tcsh tcsh, whereas others are questionable. In addition, this command may take a while because find find must traverse the entire must traverse the entire /usr /usr hierarchy, examining each filename for a match. This example demonstrates that if filename wildcards are used, the entire string must be quoted to prevent expansion by the sh.e.l.l prior to launching hierarchy, examining each filename for a match. This example demonstrates that if filename wildcards are used, the entire string must be quoted to prevent expansion by the sh.e.l.l prior to launching find find.

find is among the most useful commands in the Linux administrator"s toolkit and has a variety of useful options. is among the most useful commands in the Linux administrator"s toolkit and has a variety of useful options. find find is handy in certain cases. For example: is handy in certain cases. For example: You need to limit a search to a particular location in the filesystem.

You must search for an attribute other than the filename.

Files you are searching for were recently created or renamed, in which case locate locate may not be appropriate. may not be appropriate.

Refer to Chapter6 Chapter6, for additional information on the find find command. command.

On the ExamYou should have a general understanding of find find. Remember that by default, find find prints matching directory entries to the screen. However, detailed knowledge of prints matching directory entries to the screen. However, detailed knowledge of find find options and usage are beyond the scope of LPIC Level 1 exams. options and usage are beyond the scope of LPIC Level 1 exams.

Name locate Syntax locatepatterns Description Locate files whose names match one or more patterns patterns by searching an index of files previously created. by searching an index of files previously created.

Example Locate files by name in the entire directory hierarchy that might have something to do with the csh csh sh.e.l.l or its variants: sh.e.l.l or its variants: #locatecsh /home/jdean/.tcshrc /root/.cshrc /root/.tcshrc /usr/bin/sun-message.csh /usr/doc/tcsh-6.08.00 /usr/doc/tcsh-6.08.00/FAQ /usr/doc/tcsh-6.08.00/NewThings /usr/doc/tcsh-6.08.00/complete.tcsh /usr/doc/tcsh-6.08.00/eight-bit.txt /usr/doc/vim-common-5.3/syntax/csh.vim /usr/man/man1/tcsh.1 /usr/share/apps/ktop/pics/csh.xpm /usr/share/apps/ktop/pics/tcsh.xpm /usr/share/emacs/20.3/etc/emacs.csh /usr/share/vim/syntax/csh.vim /usr/src/linux-2.2.5/fs/lockd/svcshare.c /etc/csh.cshrc /etc/profile.d/kde.csh /etc/profile.d/mc.csh /bin/csh /bin/tcsh The locate locate command must have a recent database to search, and that database must be updated periodically to incorporate changes in the filesystem. If the database is stale, using command must have a recent database to search, and that database must be updated periodically to incorporate changes in the filesystem. If the database is stale, using locate locate yields a warning: yields a warning: #locatetcsh locate:warning:database/var/lib/slocate/slocate.db"ismore than8daysold

Name updatedb Syntax updatedb[options]

Description Refresh (or create) the slocate slocate database in database in /var/lib/slocate/slocate.db /var/lib/slocate/slocate.db.

Option -e directories directories Exclude a comma-separated list of directories directories from the database. from the database.

Example Refresh the slocate slocate database, excluding files in temporary locations: database, excluding files in temporary locations: #updatedb-e"/tmp,/var/tmp,/usr/tmp,/afs,/net,/proc"

updatedb is typically executed periodically via is typically executed periodically via cron cron.

Additional options Some Linux distributions (Debian, for example) come with a version of updatedb updatedb that accepts additional options that can be specified on the command line: that accepts additional options that can be specified on the command line: --netpaths="path1 path2 ... " "

Add network paths paths to the search list. to the search list.

--prunepaths="path1 path2 ... " "

Eliminate paths paths from the search list. from the search list.

--prunefs="filesystems ... " "

Eliminate entire types of filesystems filesystems, such as NFS.

These options modify the behavior of updatedb updatedb on some Linux systems by prohibiting the parsing of certain filesystem locations and by adding others. There are a few more of these options than those listed here, but these three are special in that they can also be specified through the use of environment variables set prior to on some Linux systems by prohibiting the parsing of certain filesystem locations and by adding others. There are a few more of these options than those listed here, but these three are special in that they can also be specified through the use of environment variables set prior to updatedb updatedb execution. The variables are execution. The variables are NETPATHS NETPATHS, PRUNEPATHS PRUNEPATHS, and PRUNEFS PRUNEFS. These variables and the options to updatedb updatedb are discussed here because this Objective makes specific mention of are discussed here because this Objective makes specific mention of updatedb.conf updatedb.conf, a sort of control file for updatedb updatedb. Despite its name, updatedb.conf updatedb.conf isn"t really a configuration file, but rather a fragment of a Bourne sh.e.l.l script that sets these environment variables. isn"t really a configuration file, but rather a fragment of a Bourne sh.e.l.l script that sets these environment variables. Example7-2 Example7-2 shows a sample shows a sample updatedb.conf updatedb.conf file. file.

Example7-2.Sample updatedb.conf file #Thisfilesetsenvironmentvariablesusedbyupdatedb #filesystemswhichareprunedfromupdatedbdatabase: PRUNEFS="NFSnfsafsprocsmbfsautofsautoiso9660"

exportPRUNEFS #pathswhichareprunedfromupdatedbdatabase: PRUNEPATHS="/tmp/usr/tmp/var/tmp/afs/amd/alex"

© 2024 www.topnovel.cc