OpenSource For You

Tips & Tricks

-

An alternativ­e for the dd command

We are comfortabl­e using the dd command in our day to day administra­tion of computers and servers. An alternativ­e to it is the dcfldd command, which also shows a progress report of the process. dcfldd is an enhanced version of dd, developed by the US Department of Defence Computer Forensics Lab.

To use dcfldd, we first need to install it, for which you can use the following command:

$sudo apt-get install dcfldd

$dcfldd if=<source> of=<destinatio­n>

For example:

$dcfldd if=/dev/zero of=/dev/null

The output is:

425216 blocks (13288Mb) written.

—Rupin Puthukudi, rupinmp@gmail.com

A beginner’s guide to Curl

The Curl command is used to transfer data from or to a server. It is used with the following protocols: HTTP, HTTPS, FTP, SFTP, TFTP, DICT, TELNET, LDAP, IMAP, SCP, SMTP and SMTPS.

Curl can be used inside the scripts. When you download using the Curl command, you can easily pause or resume the download. There are 120 command line options with the Curl command. It supports cookies, forms and SSL, multiple uploads with a single command and IPv6.

For example:

$curl http://www.my.org

The above command shows the contents of this website in your terminal. If you want to save the output of the Curl command, you can use the redirect symbol > or the -o option.

For example:

$ curl http://www.centos.org > file.txt

…or:

$ curl http://www.centos.org -o file.txt

Now let’s look at how to download multiple files using the Curl command:

$curl -O http://ftp.open.com/pub/axt.html -O http://ftp.gnu.

com/pub/bxy.html -O

http://ftp.lkj.com/pub/c.html

An important fact to note here is that Curl will use the same TCP connection to download multiple files. This is done to improve the download speed. When we use Curl O (uppercase O), it will save the contents in the file with the original file name in the local machine. If we use -o (lowercase o), then we need to give the file name in the command.

Curl is automatica­lly redirected to a new URL if we use the -L option.

For example:

$curl -L google.com

After running the above command, you can cancel the downloadin­g process using Ctrl+c, and then if we want to resume downloadin­g from the last point, use the C option.

$curl -C - -O http://ftp.local.com/pub/test.gz

** Resuming transfer from byte position 28609

% Total % Received % Xferd Average Speed Time Time Time Current

To limit the data rate in the Curl command, use the --limit-rate option, as follows:

$ curl --limit-rate 1000B -O http://ftp.local.com/pub/test.gz

 ??  ??
 ??  ??
 ??  ??

Newspapers in English

Newspapers from India