09 Mar

Download Entire Folder using Wget Command in Linux

wget -m http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/

-m, –mirror
shortcut for -N -r -l inf –no-remove-listing.

wget -H -r --level=1 -k -p http://www.tldp.org/HOWTO/Serial-Programming-HOWTO/

-r, –recursive
Specify recursive download.
-l, –level=NUMBER
Maximum recursion depth (inf or 0 for infinite).
-k, –convert-links
Make links in downloaded HTML point to local files.
-p, –page-requisites
Get all images, etc. needed to display HTML page.

Original Article
wget Manual

08 Mar

Change the Extension of Multiple Files in Linux

In this example, we will change all files with extension ‘.info’ to ‘.txt’.

Rename all *.info files in one folder

rename .info .txt *.info

That should read as..

rename <replace this string> <with this string> <in all these files>

Do the same operation recursively in a directory tree

find . -name "*.info" -exec rename .info .txt {} \;

Those double quotes around *.info are important – don’t remove them mm-kay?


07 Mar

Using PHP’s Curl functions behind a Proxy

Using PHP’s Curl functions even if the net is accessible only thru a proxy. This is the only way curl can be used if you use GoDaddy’s hosting.

$ch = curl_init("http://rss.news.yahoo.com/rss/topstories");

curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_PROXY, "");
curl_setopt($ch, CURLOPT_PROXYPORT, 80);
//curl_setopt ($ch, CURLOPT_PROXYUSERPWD, "username:password");

$data = curl_exec ($ch);
print $data;
07 Mar

Changing separator with Perl

This will join all lines of a file together. Sometimes I have a list of something in a file, one line per item and want to convert it to a comma(colon,tab)-separated line (with no trailing separator of course) that can be used as a command-line parameter to some other tool.

perl -e '@_=; chomp(@_); print join(";",@_);' < data_file
05 Mar

CVS Through Proxy

Command to import a CVS project’s code through a proxy

Checkout code from remote  server(No Proxy)
cvs -z3 -d:ext:binnyva@nexty.cvs.sourceforge.net:/cvsroot/nexty co -d Nexty nexty

CVS through a Proxy
cvs -z3 "-d:pserver;proxy=;proxyport=80:binnyva@nexty.cvs.sourceforge.net:/cvsroot/nexty" co -d Nexty nexty

I don’t know how to commit the changes. If someone knows, please leave a comment, mm-kay?
[tags]cvs,command,source control,proxy[/tags]