Pages

Showing posts with label one liners. Show all posts
Showing posts with label one liners. Show all posts

Linux Onliners


To copy multiple files to multiple-different names
for f in *.txt ; do cp -p "$f" " ${f/text/texttobereplaced"; done

To copy a single file to multiple files 
for file in foo*.txt; do cp singlefile "$file" ; done
Note: Here, you have to create the files using touch.


To check the total size of a list of files in a directory
du -ch *.out | tail -n 1


To find all the instances of files with specific extension and delete all of them (recursively).
Before deleting, check all the files that will be deleted
find . -name "*.bak" -type f
Now, to if you are sure that these are the files to delete, run following command.
find . -name "*.bak" -type f -delete



Reference
Ask Ubuntu


You may be interested in these posts

Error in image file conversion: convert-im6.q16: not authorized `test.eps' @ error/constitute.c/WriteImage/1037.

This error is because of the vulnerability. This allows remote execution of code using image formats. So, some Linux distributions by defaul...