Skip to content

Commit 8df1340

Browse files
learning find
Signed-off-by: Arnob kumar saha <[email protected]>
1 parent 61d5c56 commit 8df1340

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

common/find.bash

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# AUTHOR : Arnob kumar saha
44
# Date created : 26-01-2022
5-
# Lase modified : 26-01-2022
5+
# Lase modified : 05-09-2023
66

77
# DESCRIPTION : This script will show some stuffs that can be done using find.
88
# USAGE : ./find.bash
@@ -15,7 +15,7 @@ find ./demo # find everything (multilevel) in demo directory
1515
-type f # only files
1616

1717
-name <a-name> # wildcard supported
18-
-iname <a-name> # case insensitive use of '-name'
18+
-iname <a-name> # case insensitive use of '-name'
1919

2020
# m for modified, min for minute
2121
-mmin -10 # those are modified less than 10 minutes ago
@@ -30,4 +30,12 @@ find ./demo # find everything (multilevel) in demo directory
3030

3131
find demo -exec chown arnob:some-group {} + # executing `chown arnob:some-group <file-name>` commnad
3232
# {} is just a placeholder for file-name, And + is the sign to end the exec command.
33-
# \; could be used instead of + and any sign could be used as placeholder
33+
# \; could be used instead of + and any sign could be used as placeholder
34+
35+
find . -path */store/* # Find the paths that match */store/*
36+
find . -iname *.sh -o -name *.bash # all shell or bash files
37+
find . ! -name p*.bash # not operator
38+
39+
# to find the readme files with path */doc/*, or license files with arbitrary paths
40+
find / \( -path */doc/* -name README \) -o -name LICENSE # backslashes to escape
41+

0 commit comments

Comments
 (0)