Skip to content

Instantly share code, notes, and snippets.

@copley
Last active April 21, 2023 17:33
Show Gist options
  • Save copley/f0427eb484f25e1bb7930e1ff6e693d0 to your computer and use it in GitHub Desktop.
Save copley/f0427eb484f25e1bb7930e1ff6e693d0 to your computer and use it in GitHub Desktop.
Bash Hints
Find .class files,
# find . -mindepth 3 -maxdepth 5 -name "*.class"
Find the passwd file under all sub-directories starting from root directory.
# find / -name passwd
./usr/share/doc/nss_ldap-253/pam.d/passwd
./usr/bin/passwd
./etc/pam.d/passwd
./etc/passwd
Find the passwd file under root and one level down. (i.e root — level 1, and one sub-directory — level 2)
# find -maxdepth 2 -name passwd
./etc/passwd
Find the passwd file under root and two levels down. (i.e root — level 1, and two sub-directories — level 2 and 3 )
# find / -maxdepth 3 -name passwd
./usr/bin/passwd
./etc/pam.d/passwd
./etc/passwd
Find the password file between sub-directory level 2 and 4.
# find -mindepth 3 -maxdepth 5 -name passwd
./usr/bin/passwd
./etc/pam.d/passwd
4. Executing Commands on the Files Found by the Find Command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment