Changes between Version 8 and Version 9 of Csle2022/Agenda/linuxpackagemanagement


Ignore:
Timestamp:
Oct 19, 2022, 7:03:46 PM (2 years ago)
Author:
deepthi
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Csle2022/Agenda/linuxpackagemanagement

    v8 v9  
    191191==== find ====
    192192
     193The find command in UNIX is a command line utility for walking a file hierarchy. It can be used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions. By using the ‘-exec’ other UNIX commands can be executed on files or folders found.
     194
     195`$ find [where to start searching from]`
     196
     1971. Search a file with specific name.
     198
     199`$ find ./folder -name sample.txt `
     200
     2012. Search a file with pattern.
     202
     203`$ find ./folder -name *.txt `
     204
     205It will give all files which have ‘.txt’ at the end.
     206
     2073. How to find and delete a file with confirmation.
     208
     209`$ find ./folder -name sample.txt -exec rm -i {} \; `
     210
     2114. Search for empty files and directories.
     212
     213`$ find ./folder -empty`
     214
     2155. Search for file with entered permissions.
     216
     217`$ find ./folder -perm 664`
     218
     2196. Search text within multiple files.
     220
     221`$ find ./ -type f -name "*.txt" -exec grep 'Geek'  {} \;`
     222
     223
    193224==== grep ====
    194225