2. Exam Objectives
Key Knowledge Areas
Understand the correct locations of files under the FHS.
Find files and commands on a Linux system.
Know the location and purpose of important file and directories as defined in the FHS.
Objective 4: Devices, Linux Filesystems, Filesystem Hierarchy Standard
Find system files and place files in the correct location Weight: 2
Terms and Utilities
find
locate
updatedb
whereis
which
type
/etc/updatedb.conf
2
3. File system Hierarchy Standard
3
Directories required in / by the Filesystem Hierarchy Standard
Set of requirements and guidelines for file and directory placement under UNIX-like operating systems.
Directory Description
bin Essential command binaries
boot Static files of the boot loader
dev Device files
etc Host-specific system configuration
lib Essential shared libraries and kernel modules
media Mount point for removable media
mnt Mount point for mounting a filesystem temporarily
opt Add-on application software packages
sbin Essential system binaries
srv Data for services provided by this system
tmp Temporary files
usr Secondary hierarchy
var Variable data
http://www.pathname.com/fhs/
Create partitions and filesystems
5. Locating Files
# find /home/angie –name stuff
/home/angie/stuff
# find /home/angie –user root
/home/angie/morestuff
find utility is used to search for files.
5
Find system files and place files in the correct location
Syntax: find /path expression
Ex:
Options:
-atime Searches based on the number of days since last accessed.
-ctime Searches based on the number of days since directory entry last changed.
-group Searches for files belonging to the specified group.
-newer Searches for files more recent than the specified file.
-name Searches for files with names matching the specified string.
-user Searches for files belonging to the specified user.
6. Locating Files
locate provides a secure way to index and quickly search for files on your system.
Uses slocate database, by default, to find file locations. Db is updated with cmd updatedb
6
Find system files and place files in the correct location
Syntax: locate –options arguments
Options:
-u Start at / when creating the slocate database.
-U /PATH Start at the specified path when creating the slocate database.
-e DIR Exclude the specified directories when creating the slocate database.
-c Parses the /etc/updatedb.conf file when creating the database.
-i Searches without regard to case.
-o FILE Specifies the output file to create.
-d PATH Specifies the path of databases to search.
The database is located in: /etc/updatedb.conf
7. Locating Files
# which locate
/usr/bin/locate
which takes one or more arguments. For each argument it prints to stdout
7
Find system files and place files in the correct location
Syntax: which –options program-name
Ex:
8. Locating Files
whereis locates source/binary and manuals sections for specified files.
8
Find system files and place files in the correct location
Options:
-b Searches for binaries.
-m Searches for manual entries.
-s Searches for sources.
-u Searches for unusual entries that don’t have one entry for each type.
-B Changes where whereis searches for binaries.
-M Changes where whereis searches for manual sections.
-S Changes where whereis searches for source code.
# whereis ls
ls: /bin/ls /usr/man/man1/ls.1.gz
Ex: