Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

command to find a file or directory in the current directory

find . -name 'filename or wildcard'
# Example;
find . -name '*.js'

# -name is case sensitive. 
# To find using name irrespective of case (case insensitive) use the option -name
# Example;
find . -type f -iname 'F*' 

# for files only (ignore directories) -type f 
# for directories only -type d
# for symbolic links -type l
# Example; 
find . -name -type d '*E*'

# To find using the -or operator
find . -name -type d '*E*' -or -name 'F*'

# To find by size; e.g 
# files larger than 100KB
find . -type f -size +100k

# files less than 20GB
find . -type f -size -20G

# files larger than 100MB but less than 250MB
find . -type f -size +100M -size -250M

# To find by time; e.g
# files edited more than 2 days alongside
find . -type f -mtime +2

# files edited within the last 3 days
find . -type f -mtime -3

# files edited in the last 24 hours
find . -type f -mtime -1

# To delete the file(s) after finding, simply add -delete after the command
# e.g; To delete all files edited less than 3 days ago;
find . -type f -mtime -3 -delete

# To execute additional commands on the result of find command,
# use the -exec option as below
find . -type f -size +100M -size -250M -exec ls -l {} ;
Comment

PREVIOUS NEXT
Code Example
Shell :: how to install homebrew on mac 
Shell :: bash check if string contains substring 
Shell :: run file linux 
Shell :: linux find installation location 
Shell :: how to run bash scripts 
Shell :: where is path on klai linux 
Shell :: dialog plus android github 
Shell :: git: create and remove git alias command 
Shell :: create branch from existing branch 
Shell :: commitlint, husky, commitzen 
Shell :: for loop iteration in shell script 
Shell :: kill port cli 
Shell :: heic open linux 
Shell :: how to install xfce 
Shell :: how to run shell script 
Shell :: bash for loop parallel 
Shell :: windows terminal guid 
Shell :: ubuntu connect openvpn 
Shell :: iis restart cfrom command promt windows 
Shell :: command to change user default shell 
Shell :: unzip linux 
Shell :: bash split string into array 
Shell :: git mirror repository 
Shell :: how to install nginx on docker 
Shell :: convert wsl to wsl2 
Shell :: pipenv install virtual at same path 
Shell :: linux how many cores 
Shell :: octoprint log location 
Shell :: leaflet install yarn 
Shell :: angular cli disable auto reload 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =