Last active
May 22, 2018 17:27
-
-
Save thelazyindian/a949c0de7ecf949f62623d48e52d4686 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To know what is inside file1.txt but not in file2.txt | |
awk 'NR==FNR{a[$0]=1;next}!a[$0]' file2 file1 | |
To delete everything in a dir except file.txt | |
find . ! -name 'file.txt' -type f -exec rm -f {} + | |
Remove first n character from bunch of file names with Cut | |
rename -n 's/(.{5})(.*)$/$2/' *.* | |
The -n is for simulating; remove it to get the actual result. | |
To sort all lines in a file.txt | |
sort file.txt -o f file.txt | |
get md5sum of all files in a folder tree | |
find . -type f 2>/dev/null -exec md5sum {} \; >checksum.txt | |
list all files in dirs and subdirs with full path | |
find . -type f -exec ls {} \; | |
find which lines are present in 2.txt and not in 1.txt | |
grep -v -f 1.txt 2.txt > 3.txt | |
Delete all files whose size is more than 100MB | |
find -type f -size +100M -exec rm -rf {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment