Awesome commands that can make your work lot more simpler
if you wish to delete a file which is older than x minutes, you can use the below command
you can also execute commands
How to sort the finded file based on Size
How to print all the file in Directory and separate by Line (============== )
How to move particular files from one directory to other directory
example:
I/p:
2.https://unix.stackexchange.com/questions/430106/delete-files-older-than-x-minutes
3.https://unix.stackexchange.com/questions/430381/order-all-files-by-size-using-find
4. example from Man page of find command and with few additional command to make it look better
5.https://www.cyberciti.biz/tips/howto-linux-unix-find-move-all-mp3-file.html
6.https://unix.stackexchange.com/questions/430550/split-single-line-into-multiple-lines-newline-character-missing-for-all-the-lin
if you wish to delete a file which is older than x minutes, you can use the below command
find . -type f -mmin +30 -delete
Run script in all directoryfind . -type d -execdir /path/to/script.sh {} \;
you can also execute commands
How to sort the finded file based on Size
find . -type f -iname "*.$extension" -print0 | xargs -0 ls -lS
How to print all the file in Directory and separate by Line (============== )
find . -type f -exec cat -n {} \; -exec echo "==================================================" \;
How to move particular files from one directory to other directory
find . -iname "*.csv" -type f | xargs -I '{}' mv {} ~/data/csv
here we copy all csv file from current directory to ~/data/csv folder
Split single line into multiple linesexample:
I/p:
A,B,C,D,E,F,G,H,I,J,K,L,M,N,O
O/p:
A,B,C
D,E,F
G,H,I
J,K,L
M,N,O
this can be done using tr , '\n' <filename | paste -d, - - -
Source:
1.https://unix.stackexchange.com/questions/430089/how-can-i-run-script-for-all-directories2.https://unix.stackexchange.com/questions/430106/delete-files-older-than-x-minutes
3.https://unix.stackexchange.com/questions/430381/order-all-files-by-size-using-find
4. example from Man page of find command and with few additional command to make it look better
5.https://www.cyberciti.biz/tips/howto-linux-unix-find-move-all-mp3-file.html
6.https://unix.stackexchange.com/questions/430550/split-single-line-into-multiple-lines-newline-character-missing-for-all-the-lin
Comments
Post a Comment