Tuesday, April 17, 2012

useful linux tools

getting ip address:

just needed a quick way to get the ip address of a certain network interface in a script. To dynamically update the bind address of a jboss application server.


ifconfig | grep eth2 -A 1 | grep inet | awk '{print $2}' | awk -F ':' '{print $2}'



gzipping all txt files in a directory with a lot of files, when the error:


-bash: /usr/local/fink/bin/gzip: Argument list too long


occurs.


find /Volumes/Thunderbolt\ SSD/data/ -name '*.txt' -exec gzip -vf {} \;

No comments:

Post a Comment