Compare directories using diff.
bash |copy code |?
1 diff -qr dirA dirB | sort
Compare directories using diff.
bash |copy code |?
1 diff -qr dirA dirB | sort
Loop files under a set weight to move it to a directory.
bash |copy code |?
1 for f in `find . -iname "*.JPG" -size -500k`; do mv ${f} small; done
This command works in systems running apt . With dpkg you can list all packages installed and the output is filtered with grep.
bash |copy code |?
1 2
bash |copy code |?
1 dpkg −l | grep chrome
Format an usb drive from cli. With fdisk you can list existing partitions in the system.
bash |copy code |?
1 fdisk -l2 # -c option checks for bad sectors3 mkfs -t ext3 -c /dev/sde1
Simple command to find out what shell you are using.
bash |copy code |?
1 ps -ef | grep $$ | awk '{print $8}'
If you want to know what files a rpm package copied to your system, you can find it out executing the following command:
bash |copy code |?
1 rpm -ql foo
Find files and directories containning your search terms, and delete them witout confirmation and recursively. No matter if they are not empty.
bash |copy code |?
1 find . -name "search_terms" -exec rm -rf {} \;
Wget is a tool to download websites from cli. How to download an entire site could be acomplished with the following example:
bash |copy code |?
01 wget \02 --recursive \03 --no-clobber \04 --page-requisites \05 --html-extension \06 --convert-links \07 --restrict-file-names=windows \08 --domains demosite.org \09 --no-parent \10 www.demosite.org/html/
How to split a file in chunks and how to put them back together.
bash |copy code |?
01 ### SPLIT LONG:02 split --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_03 split --verbose --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_04 05 06 ### SPLIT SHORT:07 split -b 5m -a 2 -d image.iso image.iso.part_08 09 10 split --verbose -b 5m -a 2 -d image.iso image.iso.part_11
How to remove an ssh host by name or ip from your authorized hosts file.
### RESTORE