OpenSource For You
Tips & Tricks
An alternative for the dd command
We are comfortable using the dd command in our day to day administration of computers and servers. An alternative 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=<destination>
$dcfldd if=/dev/zero of=/dev/null
The output is:
425216 blocks (13288Mb) written.
—Rupin Puthukudi, email@example.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.
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.
$ curl http://www.centos.org > file.txt
$ 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.
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 automatically redirected to a new URL if we use the -L option.
$curl -L google.com
After running the above command, you can cancel the downloading process using Ctrl+c, and then if we want to resume downloading 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