/usr
and /var
hierarchies are complex enough to have complete sections of the FHS devoted to them./usr
Contains binaries, libraries, documentation, and source-code for second level programs./var
filesystem contains variable data files, including spool directories and files, administrative and logging data, and transient and temporary files. Some portions of /var
are not shareable between different systems, but others, such as /var/mail
, /var/cache/man
, /var/cache/fonts
, and /var/spool/news
, may be shared.PATH=$PATH:/new/path/dir
or by adding thant inside .bash_profile or .bashrc .which
command to search your path and find out which command will be executed (if any) when you type a command.Thewhich
command shows you the first occurrence of a command in your path. If you want to know if there are multiple occurrences, then add the-a
option
which
command will not find, such as shell builtins.type
command is a builtin that understand bash keywords and can tell us how a given command string will be evaluated for execution.whereis
command.whereis
command can also search for man pages and source codes of programs alongside their binary location .find
command is the Swiss Army knife of file-searching tools on Linux systems. Two other capabilities that you may find useful are its ability to find files based on user or group name and its ability to find files based on permissions.-user
and -group
parameters respectively.use -nouser or -nogroup to search for a file with no user or with no group id.
find / -perm 644
find / -perm -644
. find -mindepth num -maxdepth num -name file
:Like other tests, you can add a ! just before any phrase to negate it. So this will find files not belonging to user1 :find . ! -user user1
find
command searches all the directories you specify, every time you run it. To speed things up, you can use another command, locate
, which uses a database of stored path information rather than searching the filesystem every time.locate
command searches for matching files in a database that is usually updated daily (by cron job).locate
command matches against any part of a path name, not just the file name. /var
filesystem, in a location such as /var/lib/locatedb
. This may be different on systems that use slocate or mlocate packages to provide additional security or speed. You can find statistics on your locate database using locate-S :updatedb
command. (
This is usually run daily as a cron job).use -v for verbose mode to see what is going on after updatedb command!
/etc/updatedb.conf
, or sometimes /etc/sysconfig/locate
, is the configuration file for updatedb:
/tmp
or /var/spool
. You can let locate to search for them too if you like by manipulating this file.