Usefull Linux Command

From Objectif Client Inc
Revision as of 17:04, 21 October 2014 by Nicolas Rollin (talk | contribs) (Created page with "== Find == *Find every file under the directory /usr ending by "js". <pre>find /usr -name *js</pre> *Find every file under the directory /home owned by the user bob. <pre>f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Find

  • Find every file under the directory /usr ending by "js".
find /usr -name *js
  • Find every file under the directory /home owned by the user bob.
find /home -user bob
  • Find every file under the directory /var/spool that was modified more than 60 days ago.
find /var/spool -mtime +60
  • Find files named core in or below the directory /tmp and delete them, processing filenames in such a way that file or directory names containing single or double quotes, spaces or newlines are correctly handled. The -name test comes before the -type test in order to avoid having to call
find /tmp -name core -type f -print0 | xargs -0 /bin/rm -f
  • Runs `file' on every file in or below the current directory

find . -type f -exec file '{}' \;