Compare directories using diff.
diff -qr dirA dirB | sort
Tag: command
-
Compare two Directories Using Diff
-
Move small files to separate directory in one command
Loop files under a set weight to move it to a directory.
for f in `find . -iname "*.JPG" -size -500k`; do mv ${f} small; done -
Check if a program (ex: Chrome) is installed
This command works in systems running apt . With dpkg you can list all packages installed and the output is filtered with grep.
dpkg −l | grep chrome -
Ext3 format USB Drive on Linux
Format an usb drive from cli. With fdisk you can list existing partitions in the system.
fdisk -l
# -c option checks for bad sectors
mkfs -t ext3 -c /dev/sde1 -
What is the shell you are currently in ?
Simple command to find out what shell you are using.
ps -ef | grep $$ | awk '{print $8}'
-
List Files in RPM Installed Package
If you want to know what files a rpm package copied to your system, you can find it out executing the following command:
rpm -ql foo
-
Find and delete
Find files and directories containning your search terms, and delete them witout confirmation and recursively. No matter if they are not empty.
find . -name "search_terms" -exec rm -rf {} \; -
Download a Web Site with wget
Wget is a tool to download websites from cli. How to download an entire site could be acomplished with the following example:
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--restrict-file-names=windows \
--domains demosite.org \
--no-parent \
www.demosite.org/html/ -
Split and join files
How to split a file in chunks and how to put them back together.
### SPLIT LONG:
split --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_
split --verbose --bytes=5m --suffix-length=2 --numeric-suffixes image.iso image.iso.part_### SPLIT SHORT:
split -b 5m -a 2 -d image.iso image.iso.part_
split --verbose -b 5m -a 2 -d image.iso image.iso.part_### RESTORE
cat image.iso.part_* > image.iso -
Remove RSA key for ssh authorized hosts file
How to remove an ssh host by name or ip from your authorized hosts file.
ssh-keygen -R {server.example.com}
ssh-keygen -R {ssh.server.ip.address}