Giriş
Açıklaması şöyle
Using -perm, we can find all files with a particular permission combination.
Here are all the options for checking access/modify time:-amin n - the file was last accessed within n minutes ago.-atime n - the file was last accessed within n days ago.-cmin n - the file status changed within n minutes ago.-ctime n - the file status changed within n days ago.-mmin n - the file was last modified within n minutes ago.-mtime n - the file was last modified within n days ago.-anewer file - the searched file was modified more recently than [FILE]. If using -L or -H, and [FILE] is a symbolic link, then the file it points to is used.-cnewer file - the search for file status changed more recently than [FILE]. If using -L or -H, and [FILE] is a symbolic link, then the file it points to is used. If you add -daystart to the end of any of these, the measurement will be taken from the start of the current day, rather than the current time,
Finally, + and - modifications are also available. For instance, -amin -5 will find anything modified in the last 5 minutes, but -amin +5 will find anything modified more than 5 minutes ago.
-mmin on the other hand can count in minutes. So, if strict accuracy is vital, then -mmin +1440 ( 1440 minutes = 1 day ) could be used instead of -mtime +1
find . -name "*.txt" -mmin 5 -daystart
In other words, -mtime can count only in units of 24 hours or one day each so as far as -mtime +1 goes, this means exactly more than one day by at least one day ( ie. two days+ )Örnek
find "$DESDIR" -mtime +6 -type f -delete
... the full list of units can be found below:
b - 512-byte blocks (default).
c - just bytes.
w - two-byte words.
k - Kilobytes.
M - Megabytes.
G - Gigabytes.
find ./test -size -10M
Using the -group or -user options, we can also find a directory or file by who owns it, or which group it belongs to.
find ./test -group someGroup
find /directory ! -user myusername -printf "%u %p\n"
Since there are many different types of files and directories, it is not always useful to just search for a specific string. If we want to mention the type of file or directory we are looking for, we can specify it with the -type option. To remove ambiguity, we also add the -name option before our search string. You can also just remove the search string entirely, and search for a particular file type.
A full list of all types can be found below:b - block devicesc - character devicesd - directoryp - named pipe (FIFO)f - regular filel - symbolic link - never used if we use the symbolic link -L option.s - socket
find ./test -type f -name "*.txt"
find /path/to/directory -maxdepth 1 -type l -delete
... you can use command -v to check for availability of a command. No need to check its output, command will tell you via its exit status if it succeeded to find the command or not (regardless of whether it's an external command found in $PATH, a builtin or a function)command is a mandatory POSIX utility. The -v option to command used to be optional, but it's not any longer in the latest version of the POSIX specification
#!/usr/bin/sh -main() {for mycommand doprintf >&2 '%s\n' "Checking $mycommand"if ! command -v -- "$mycommand" > /dev/null 2>&1; thenprintf >&2 '%s\n' "I think I am missing $mycommand"fidone}main less asdf
xmlstarlet select --template --value-of '//minSeaLevelPres' -n weatherdata.kml
Aynı şeyi şöyle de yapabilirizxclip -selection clipboard -o | grep FAIL
xclip -sel c -o | grep FAIL