Skip to content

Instantly share code, notes, and snippets.

@k7faq
Created May 6, 2017 21:16
Show Gist options
  • Select an option

  • Save k7faq/9b3825ee61fea3eb27eb00c71ae622f2 to your computer and use it in GitHub Desktop.

Select an option

Save k7faq/9b3825ee61fea3eb27eb00c71ae622f2 to your computer and use it in GitHub Desktop.
Which and Whereis locate man pages and locations of binary files for a specific program.
$ which pwd
$ whereis pwd
Locate uses database that needs updated (by cron)
$ locate pwd
$ updatedb ← updates locate database
$ locate kernel | grep /usr ← find “kernel” in path or file name within the /usr folder
Find
$ find <begining location> -name '<string>' ← example find . -name 'cron*' will find all files within current and recursive that contain 'cron*' in the name of the file or content within the file
type f ← parameter will restrict to only files named ...
type d ← find only directories named …
perm 777 ← find all files with permissions 777
$ find /home -perm 777 -exec chmod 555 {} \; ← modify all files found with 777 permission, {} = foreach, \; = complete the line
$ find / -mtime +1 ← find all files modified within last day
$ find / -a +1 ← find all files accessed within
$ find / -group nameOfGroup ← find all files owned by group
$ find . -size 1M ← find all files that are 1 megabyte
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment