User Tools

Site Tools


wiki:finding_files

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
wiki:finding_files [2020/04/29 17:51] – created walkeradminwiki:finding_files [2023/04/03 17:12] (current) walkeradmin
Line 1: Line 1:
 ====== Finding Files ====== ====== Finding Files ======
 <color darkorange>Apr 2020</color> <color darkorange>Apr 2020</color>
 +\\ 
 +<color darkorange>Updated Apr 2023</color>
 \\  \\ 
 \\  \\ 
Line 9: Line 11:
  
 One thing I have always struggled with is finding things in CentOS. So here I am going to put a few examples, and over time hopefully add some more. One thing I have always struggled with is finding things in CentOS. So here I am going to put a few examples, and over time hopefully add some more.
 +\\ 
 +\\ 
 +<color #ed1c24>If you are not 'root' then you can't search for any file/folder that requires root privileges.</color>
 \\  \\ 
 \\  \\ 
Line 15: Line 20:
 ==== Examples ==== ==== Examples ====
  
-find / -file "install.sh"+To find a file, use: <color #ed1c24>find / -file "install.sh"</color> 
 +I think -file should be - name: <color #ed1c24>find / -name "install.sh"</color> 
 +\\  
 +\\  
 +In the above example, the "/" is root, so find will look in root and all of its subfolders for a file called "install.sh"
 +\\  
 +\\  
 +You can specify a location to search with <color #ed1c24>find /home "filename.ext"</color> 
 +\\  
 +\\  
 +If you are unsure about the filename, but can remember some of it, a wildcard search might help: <color #ed1c24>find / -name “myFile*”</color> 
 +\\  
 +\\  
 +Find files with the same extension: <color #ed1c24>find / -name *.log</color> 
 +\\  
 +\\  
 +If you only wish to find folders then use -type d: <color #ed1c24>find / name home -type d</color> 
 +\\  
 +\\  
 +If you are only interested in files created in the last 2 days use: <color #ed1c24>find / -name home -type d -mtime -2</color> This looks for folders called home created in the last 2 days. 
 +\\  
 +\\  
wiki/finding_files.1588179108.txt.gz · Last modified: 2023/03/09 22:35 (external edit)