Skip to content

Instantly share code, notes, and snippets.

@bsenduran
Last active February 5, 2022 13:07
Show Gist options
  • Save bsenduran/4f5583acb84d0f96ee3a to your computer and use it in GitHub Desktop.
Save bsenduran/4f5583acb84d0f96ee3a to your computer and use it in GitHub Desktop.
Get the md5sum for files in a directory
----------------------------------------
$ ls | xargs md5sum
If the file name contains white space, set the delimiter to new line (default delimiter is white space)
$ ls | xargs -d'\n' md5sum
Estimate the directories / files size
$ ls | xargs du -sh
Get the result sorted
$ ls | xargs du -s | sort -n
Square root of 2 in 100 decimal
$ echo 'scale=100; sqrt(2)' | bc
extract file.tar.gz or file.tgz
$ tar -xvzf file.tar.gz
create file.tar.gz or file.tgz
$ tar -cvzf filename.tar.gz file(s)
extract file.tar.bz2 or file.tbz2
$ tar -xvjf file.tar.bz2
create file.tar.bz2 or file.tbz2
$ tar -cvjf filename.tar.bz2 file(s)
x --> extract
c --> create
v --> verbose
z --> deal with gun zipped files
j --> deal with bzipped files
f --> read from a file
exclude files when do a grep
$ grep -r --exclude="*.log" PATTERN *
delete everything inside a quote in VIM
>>> di"
unzip multiple zip files
$ ls | xargs -n1 unzip
Create random text file (human readable) [10M]
base64 /dev/urandom | head -c 10485760 > file.txt
view jars content
jar tvf jarName.jar | less
acquire a heap dump
jmap -dump:format=b,file=heapdump.hprof <pid>
convert images to pdf
convert-im6 img1.jpg img2.jpg img3.jpg document.pdf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment