-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbash.txt
27 lines (17 loc) · 953 Bytes
/
bash.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## Find directories that do NOT contain a file whose name I know
## source: https://askubuntu.com/questions/196960/find-directories-that-dont-contain-a-file
find base_dir -mindepth 2 -maxdepth 2 -type d '!' -exec test -e "{}/name_of_my_file.file" ';' -print
## Find files in a directory that contain patterns which are in a text file
ls my_directory/ | grep -f file_containing_patterns.txt
## Find directories by linux permission value. This finds all directories that have read permission for user and anything else for the other fields
find ./ -type d -perm /u=r
## Find some files and then move them somewhere
## source: https://unix.stackexchange.com/questions/154818/how-to-integrate-mv-command-after-find-command
find path_A -name '*AAA*' -exec mv -t path_B {} +
less file
LINE_NUMBERg
vi +LINE_NUMBER file
## sort by date modified
ls -t
## search for text inside files (e.g. .R files)
grep -rnw --include=\*.R './' -e 'TEXT_TO_SEARCH'