Posts tagged find

find Cheat Sheet

-P
Never follow symbolic links
-L
Follow symbolic links
-H
Do not follow symbolic links, except while processing the command line arguments
-type type
Find files of type

  • b – block (buffered) special
  • c – character (unbuffered) special
  • d – directory
  • p – named pipe (FIFO)
  • f – regular file
  • l – symbolic link; this is never true if the -L option or the -follow option is in effect, unless the symbolic link is broken. If you want to search for symbolic links when -L is in effect, use -xtype.
  • s – socket
-size n
File uses n units of space

  • b – for 512-byte blocks (this is the default if no suffix is used)
  • c – for bytes
  • w – for two-byte words
  • k – for Kilobytes
  • M – for Megabytes
  • G – for Gigabyte
-maxdepth levels
Descend at most levels (a non-negative integer) levels of directories below the command line arguments. ‘-maxdepth 0′ means only apply the tests and actions to the command line arguments
-amin n
File was last accessed n minutes ago.
-atime n
File was last accessed n*24 hours ago. When find figures out how many 24-hour periods ago the file was last accessed, any fractional part is ignored
-cmin n
File’s status was last changed n minutes ago.
-ctime n
File’s status was last changed n*24 hours ago.
-mmin n
File’s data was last modified n minutes ago
-mtime n
File’s data was last modified n*24 hours ago
-newer file
File was modified more recently than file

  • +7 = more than 7 days ago
  • 2 = between 2 and 3 days ago
  • -2 = within the past 2 days
  • +1 = more than 1 day old
  • 1 = between 1 and 2 days ago
  • -1 = within the past 1 day
  • 0 = within the past 1 day
  • +n = for greater than n
  • -n = for less than n
  • n = for exactly n
-group gname
File belongs to group gname
-user uname
File is owned by user uname
-exec command
Execute command

Cheat Sheets

This page will house all the Cheat Sheats that I have written. If you have a request for a cheat sheet that you would like to see, or changes to an existing cheat sheet, you can email me at admin[at]poundbangwhack.com.

Read the rest of this entry »

Linux Command-Line Cheat Sheet Posted

I have posted today my Linux Command-Line Cheat Sheet. Unlike other Linux Cheat Sheets I have seen, I have created this one as more of a “targeted” cheat sheet. Instead of just containing various command-line commands, my cheat sheet focuses on providing tips/tricks for various Linux commands including common switches and options used with those commands, including grep, sed, find, tar, rpm, and more.

I have also included numerous shortcuts/key combinations for the vi/vim text editor. This may turn into it’s own cheat sheet in the near future if I continue to add to it due to the amount of info I have for vi alone. Time will tell.
Read the rest of this entry »