104.7 Find System Files and Place Files in Correct Location Flashcards
Filesystem Hierarch Standard (FHS)
defines directory structure and contents in Unix-like OS
FHS
FHS
standard maintained by Linux Foundation and as of March 2017 is on version
3.0
FHS
most distributions voluntarily choose to follow it and remain in compliance as updates are released
however some distributions deviate slightly
Directory Structure
The primary specification is that all files and directories appear under the ‘root’ directory (/),
even if stored on different physical or virtual devices (although some directories do not have to
exist at all if the dependent subsystems do not exist, such as X Windows)
Directory Structure
Directory Structure
root and root directory in FHS
/
Directory Structure
command binaries intended for all users and must be available in single user mode
/bin
Directory Structure
boot loader files (kernel, initrd, etc)
/boot
Directory Structure
Device files
/dev
Directory Structure
Host-specific config files - no binaries
/etc
Directory Structure
config files for packages stored in /opt
/etc/opt
Directory Structure
config files for software that processes SGML
/etc/sgml
Directory Structure
config files for X Windows
/etc/X11
Directory Structure
config files for software that processes XML
/etc/XML
Directory Structure
users home directory
/home
Directory Structure
libaries essential for binaries in /bin and /sbin
/lib
Directory Structure
alt format libraries - 64 bit
/lib[qual]
Directory Structure
mount point(s) for removable media - CD DVD
/media
Directory Structure
temp mounted files
/mnt
Directory Structure
options app s/w often 3rd party
/opt
Directory Structure
virtual filesystem providing process and kernel info as files and corresponds to procfs
/proc
Directory Structure
root user home directory
/root
Directory Structure
run-time var data and info about the running system since last boot
/run
Directory Structure
essential system binaries
/sbin
Directory Structure
site specific data server by the local system
/srv
Directory Structure
contains info about connected devices
/sys
Directory Structure
temp files not preserved between rboots
/tmp
Directory Structure
secondary hierarchy for read-only user data
/usr
Directory Structure
Non-essential command binaries for all users
/usr/bin
Directory Structure
Standard include files (C/C++ .h files ie)
/usr/include
Directory Structure
libraries for binaries in /usr/bin and /usr/sbin
/usr/lib
Directory Structure
alt format libraries - 64 bit
/usr/lib[qual]
Directory Structure
tertiary hierarchy for local data, specific to host
/usr/local
Directory Structure
non-essential system binaries
/usr/sbin
Directory Structure
architecture independent shared data
/usr/share
Directory Structure
source code - kernel
/usr/src
Directory Structure
older X Windows config - optional
/usr/X11R6
Directory Structure
var files whos content is expected to change during normal system use and operation
/var
Directory Structure
app cache data used as a result of time-consuming I/O or calculations and can be deleted without data loss
/var/cache
Directory Structure
state information
/var/lib
Directory Structure
lock files that keep track of resources in use
/var/lock
Directory Structure
log files
/var/log
Directory Structure
mailbox files
/var/mail
Directory Structure
var data from add-on packages stored in /opt
/var/opt
Directory Structure
run-time var data (replaced by run in 3.0)
/var/run
Directory Structure
spool for tasks waiting to be processed
/var/spool
Directory Structure
temp files to be preserved between resparts
/var/tmp
Find
find files by name returning results for the indicated string in any portion of the path or filename string exists in
locate
important
locate
use regular expressions but often used to locate a known filename or partial name including
globbing
locate
ignore case on the file being searched for
locate -i [string]
locate
config file for updatedb command managing locate database and contains full or partial filenames and extensions to ignore or prunt from database updates
/etc/updatedb.conf
which
will locate which command - including path - will run if indicated command is run without absolute path provided and can be important if there are multiple potential versions of an app as this will display which path contains the program FIRST in the PATH var
which
which
display all matches in PATH in the order they would run/appear
which -a [command]
wheris
provides more info about a command than which only provides the first matching path for it
whereis
name of command
all locations in PATH
associated man pages
wheris
searches for binaries
wheris -b
whereis
searches for manual entries in man pages
whereis -m
whereis
searches for sources
whereis -s
whereis
unusual or undocumented entries
whereis -u
type
will indicate whether a command has been extended
type
type
list all variants of indicated command
type -a
find
previously discussed the best method of finding files in the system
find
find
find matching files by indicating permission
find -perm -[####]