Finding FIles Flashcards
(14 cards)
what is the which command?
Used to locate executable files on the system; it returns any aliases and directories within the PATH variable for the command.
what is the path command?
A variable that stores a list of directories that will be searched in order when commands are executed without an absolute or relative pathname.
Q: What is the fastest method to search for files in the Linux directory tree?
A: The locate command.
Q: How does the locate command work?
A: It searches a premade, indexed database of file paths for fast results.
Q: Why might the results from locate be outdated?
A: Because the database doesn’t update in real-time as files are added or removed.
Q: How often is the database used by locate updated automatically?
A: Once per day.
Q: What command updates the locate database manually?
updatedb
Q: Where is the database used by the locate command stored?
A: /var/lib/plocate/plocate.db
Q: How can you exclude certain files, directories, or filesystems from being indexed by updatedb?
A: Add them to the /etc/updatedb.conf file (this is called pruning).
Q: What is a slower but more versatile command for locating files in Linux?
Find
Q: How does the find command work compared to locate?
A: It searches the directory tree recursively in real time, without using a premade index.
Q: What is the basic format of the find command?
A: find <start> -criterion <what></what></start>
Q: What does the type command do in Linux?
A: Displays only the first result normally outputted by the which command.
Q: What does the whereis command do in Linux?
A: Displays the location of a command as well as associated man and info pages.