<commit_before>### find and exclude all permission denied message


like this

```
find: /./proc/1731/fdinfo: Permission denied
find: /./proc/2032/task/2032/fd: Permission denied
```

Those errors are printed out to the standard error output (fd 2). To filter them out, simply redirect all errors to /dev/null:

```bash
find . 2>/dev/null > some_file
```


or first join stderr and stdout and then grep out those specific errors:

````bash
find . 2>&1 | grep -v 'Permission denied' > some_file
```



### search all file and all content



```

find . -name \*.* | xargs grep 'GMAT'

```

pay more attion about the '\'


### search all files and replace

```ruby
#Remove FactoryGirl.
find . -type f -name *_spec.rb -print | xargs  sed -ie 's/FactoryGirl\.//g'

```


```ruby
#Seems like Linux is being far too generous.

-i 's/^[[:space:]]\{11\}//g' <-- makes it look like 
"s/^[[:space:]]\{11\}//g" is the extension given to "-i"

#baf's quotes serve to clarify to the interpreter (and to humans reading it) that
there is no extension. hayne's -e is also a means with which to disambiguate.

#Thus, these all work:
sed -i "" 's/^[[:space:]]\{11\}//g' menu1a.sh 
sed -i -e 's/^[[:space:]]\{11\}//g' menu1a.sh 
sed -ie 's/^[[:space:]]\{11\}//g' menu1a.sh 
sed -i "" -e 's/^[[:space:]]\{11\}//g' menu1a.sh

#Makes sense.

```


### 

```ruby
#find and delete .svn
find . -type d -name ".svn"|xargs rm -rf
```

### find the top 10 large file



```ruby
du -ah . | sort -n -r | head -n 10
## Warning: only works with GNU find ##
find /path/to/dir/ -printf '%s %p\n'| sort -nr | head -10
find . -printf '%s %p\n'| sort -nr | head -10

#You can skip directories and only display files, type:

 
find /path/to/search/ -type f -printf '%s %p\n'| sort -nr | head -10
 
#OR

 
find /path/to/search/ -type f -iname "*.mp4" -printf '%s %p\n'| sort -nr | head -10
 


```

like this version

works well to help with find the largest file or folder, fast and easy

```ruby
du -sh `ls .` 
```<commit_msg>Update find.markdown<commit_after>### find and exclude all permission denied message


like this

```
find: /./proc/1731/fdinfo: Permission denied
find: /./proc/2032/task/2032/fd: Permission denied
```

Those errors are printed out to the standard error output (fd 2). To filter them out, simply redirect all errors to /dev/null:

```bash
find . 2>/dev/null > some_file
```


or first join stderr and stdout and then grep out those specific errors:

````bash
find . 2>&1 | grep -v 'Permission denied' > some_file
```



### search all file and all content



```

find . -name \*.* | xargs grep 'GMAT'

```

pay more attion about the '\'


### search all files and replace

```ruby
#Remove FactoryGirl.
find . -type f -name *_spec.rb -print | xargs  sed -ie 's/FactoryGirl\.//g'

```


```ruby
#Seems like Linux is being far too generous.

-i 's/^[[:space:]]\{11\}//g' <-- makes it look like 
"s/^[[:space:]]\{11\}//g" is the extension given to "-i"

#baf's quotes serve to clarify to the interpreter (and to humans reading it) that
there is no extension. hayne's -e is also a means with which to disambiguate.

#Thus, these all work:
sed -i "" 's/^[[:space:]]\{11\}//g' menu1a.sh 
sed -i -e 's/^[[:space:]]\{11\}//g' menu1a.sh 
sed -ie 's/^[[:space:]]\{11\}//g' menu1a.sh 
sed -i "" -e 's/^[[:space:]]\{11\}//g' menu1a.sh

#Makes sense.

```


### 

```ruby
#find and delete .svn
find . -type d -name ".svn"|xargs rm -rf
```

### find the top 10 large file



```ruby
du -ah . | sort -n -r | head -n 10
## Warning: only works with GNU find ##
find /path/to/dir/ -printf '%s %p\n'| sort -nr | head -10
find . -printf '%s %p\n'| sort -nr | head -10

#You can skip directories and only display files, type:

 
find /path/to/search/ -type f -printf '%s %p\n'| sort -nr | head -10
 
#OR

 
find /path/to/search/ -type f -iname "*.mp4" -printf '%s %p\n'| sort -nr | head -10
 


```

like this version

works well to help with find the largest file or folder, fast and easy

```ruby
du -sh `ls .` 
```



#### find and rename

```
find . -name "*.andnav" | rename "s/\.andnav$/.tile/"
```

At least on Ubuntu derivations rename takes a list of files from STDIN if none are on the command line. And this can be tested easily with:
```
find . -name "*.andnav" | rename -vn "s/\.andnav$/.tile/"
```
{'fraction_non_alphanumeric': 0.18135078289319934, 'fraction_numerical': 0.021032951624211264, 'mean_word_length': 2.9122486288848264, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '614975', 'n_tokens_mistral': 1728, 'n_tokens_neox': 1538, 'n_words': 598}