This was more of a cheat card for myself but figured others might find it useful too.
Searching in Nautilus can be sketchy and while 'locate
' works fine sometimes I need to be more specific when looking for a particular file to narrow down the search results.
The 'find' command is quite powerful, but tricky to commit to memory when you don't use it often.find (starting_directory) (test) (options) (match_criteria) (actions_to_perform_on_results)
Find all "jpg" files starting at filesystem's rootfind . -name "*.jpg"
nb. find / -name \*jpg
does the same thing, escape the wildcard character * and saves typing quotes.
Find directories (-type d):find . -type d
Find a specific directoryfind . -type d -name \Pictures
Use -iname
instead of -name
to ignore case.
Search multiple directories:find /usr /etc /var/www -iname \index.html
To filter out permission errors add 2>/dev/null
to the end of the line.
Search for symbolic links -type l
There are many more advanced switches which I'll add later if needed, this is just to explain basic searching.
Using 'find' to search for specific files in Linux (basic)
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment