I am trying to use xargs command using shell pipes and not able to understand how to control and use command line arguments. For example I’d like to find out all *.c file located in 100s of sub-directories and move them to another directory called ~/old.src. How do I use command line args with xargs to achieve the same?
[continue reading…]

Q. I’d like to save disk space for my FreeBSD 7 ISP server. We run webserver, nameserver from various jails under powerful HP RAID 10 server. How do I export /usr/ports from host to each jail hosted on /jail/ volume such as /jail/www, /jail/ns, /jail/sql etc?
[continue reading…]

Q. How do I find out my IP address assigned to eth0 or ra0 interface using perl?

A. If you need to know the IP address of the UNIX / Linux machine you are running on, use the following perl one liner. Perl don’t have any inbuilt facility but combination of ifconfig command ans shell pipes you can craft something as follows to display your system IP address:

Find my IP address using Perl One liner and shell pipes

Type the following command at a shell prompt:

ifconfig -a | perl -ne 'if ( m/^\s*inet (?:addr:)?([\d.]+).*?cast/ ) { print qq($1\n); exit 0; }'