MegaCmd – A Command Line Utility To Access Kim Dotcom’s Mega Cloud Storage

By | 01/01/2014

For all those Linux command line freaks, who want to access Kim Dotcom’s Megaupload replacement http://mega.co.nz through command line, here is a good news. I recently stumbled upon an open source command line client Megacmd, developed specifically for the same purpose. In this article, I will discuss how to download, install, configure and use this command line client.

MegaCmd

Megacmd is a command line utility to access Mega storage service, which provides 50GB of free cloud storage to anyone who registers with the service. The command line utility can be used to perform all sorts of tasks like file upload, download, delete, move, sync, and more. It is a wrapper on top of go-mega.

Testing Environment

  • OS – Ubuntu 13.04
  • Shell – Bash 4.2.45
  • Application – megacmd-master 0.012

A Brief Tutorial

It is quite obvious that you need to have an account with Mega. If you want to have one, you can easily register yourself. Once you have an account, just login to the service. By default, you enter in the Cloud Drive, and it looks like :

mega-cloud-drive

Now lets discuss how you can access this cloud storage service through practical examples:

1. List the contents of a directory

If you already have a directory in your cloud storage, you can easily list its contents through the list option.

Here is an example :

$ megacmd-master list mega:/Test/
mega:/Test/11.png                                  24110      2013-12-31T16:47:49+05:30
mega:/Test/Firefox_wallpaper.png                   81920      2013-12-31T16:49:27+05:30

The command used is ‘megacmd-master’, the option used is ‘list’ and the directory name is given in the format ‘mega:/Test/’, where ‘mega:/’ is the prefix and ‘Test’ is the  directory name. You can observe that the contents of the directory were listed in the output.

2. Download A File

A file can be downloaded through the get option. Here is an example :

$ megacmd-master get mega:/Test/11.png ./
Successfully downloaded file mega:/Test/11.png to ./ in 0

So you can see that the file ’11.png’ was downloaded from the cloud storage to the current working directory.

3. Upload A File

A file can be uploaded from the local system to the cloud storage through the put option.

Here is an example :

$ megacmd-master put ./practice/helloworld mega:/Test/
Copying ./practice/helloworld -> mega:/Test/ # 100.00 % of 8.6KB at 2.5K/s 3s 
Successfully uploaded file ./practice/helloworld to mega:/Test/ in 3s

So you can see that the file ‘helloworld’ was copied from the local system to the ‘Test’ directory in the cloud.

4. Delete A File

A file can be deleted from the cloud storage through the delete option.

Here is an example :

$ megacmd-master delete mega:/Test/helloworld
Successfully deleted  mega:/Test/helloworld

So you can see that the file ‘helloworld’ was deleted from the cloud storage.

5. Create a new directory

To create a new directory, just the mkdir option. Here is an example :

$ megacmd-master mkdir mega:/Test/subdir
Successfully created directory at mega:/Test/subdir

So this way, a new directory ‘subdir’ was created inside the existing ‘Test’  directory.

Other actions like move, sync, and more are also provided by this utility. Here is a snapshot of all the options :

megacmd-options

Download/Install/Configure

Here are some of the important links related to the megacmd command :

Once you download the source, compile and install it through the following commands :

$ make
$ cp megacmd-master /usr/local/bin

The configuration details are provided on the home page itself.

Pros

  • Very easy to use
  • Open-source

Cons

  • While using list option, the directory path should end with a ‘/’ suffix. Otherwise, the utility will list the meta-data information.
  • To list trash, use trash:/ prefix instead of mega:/
  • Other cons are listed on the home page under the ‘pitfalls’ section.

Conclusion

A good command line utility to access mega cloud storage. Though, I cannot comment on the stability of utility, but it can be a good starting point for those who want to build a feature-rich command line alternative to access Kim Dotcom’s cloud storage service.

2 thoughts on “MegaCmd – A Command Line Utility To Access Kim Dotcom’s Mega Cloud Storage

Leave a Reply

Your email address will not be published. Required fields are marked *