Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Tuesday, February 9, 2016

Making Deluge as the default torrent client on Linux Mint

Hi,

This post is about making "Deluge" as the default torrent client instead of "Transmission".

Run the following command to make "Deluge" the default client for magnet links.

xdg-mime default deluge.desktop x-scheme-handler/magnet

To make "Deluge" as the default torrent client, go through the following steps..

  • Right click on the torrent file.
  • Go to properties.
  • Go to "Open With" tab.
  • Select "Deluge" from the list and click "Set as default" button.

And thats all!, Happy downloding!

Sunday, August 2, 2015

Unzip all zip files in a folder in terminal.

Hi,

With the following command you can unzip all the zip files in the current folder.

unzip \*.zip

Wednesday, May 20, 2015

Unable to mount ExFat external HDD (' stderr: ERROR:._.com.apple.timemachine.donotpresent' has invalid checksum)

Hi All,

I have an external hard drive(Western Digital My Passport Ultra 1TB) which I keep all my movies, work stuff and etc. Initially I formatted the drive in ExFat format in Mac OS X platform so that I can use it in Windows and Mac. Also Ubuntu seems to have a fix to read ExFat file systems[1].

But recently when I connected this external hard drive to my Ubuntu machine, it gave me this error(something similar) saying that it cannot mount the disk: 
Error mounting /dev/sdb1 at /media/rbuse/My Passport: Command-linemount -t "exfat" -o "uhelper=udisks2,nodev,nosuid,uid=1000,gid=1000,io charset=utf8,namecase=0,e rrors=remount-ro,umask=0077" "/dev/sdb1" "/media/rbuse/My Passport"' exited with non-zero exit status 1: stdout:FUSE exfat 1.0.1

stderr: ERROR:._.com.apple.timemachine.donotpresent' has invalid checksum (0x6634 != 0x4044). '
I was stunned because all my work was in there, especially my VDIs. 

So I started my research and one solution was to plug it back in to my Mac OS X machine and use the "Disk Utility" tool to repair it(Use "Repair Disk" button) [2][3]. When I tried this, the following error came up.
Error: Disk Utility can’t repair this disk. Back up as many of your files as possible, reformat the disk, and restore your backed-up files.
I was like "Huh?!?!?" . I continued my research and found that if I attempt several times to "Repair Disk", it will work at sometime[4]. I tried like 20+ times, it didn't work.

So I googled more and found a command that should fix the broken external hard drive [5][6][7].
sudo fsck_exfat -d <device>
To find the correct value for <device>(eg : disk1s2) use the following command[8] to list down the device IDs.
diskutil list
At the end of the fsck_exfat command, I got the following error[9]. 
fsck_exfat: Could not update main boot region: Bad file descriptor
Sigh!.

As the last attempt to fix, I used the "chkdsk" command of Windows OS[10]. And IT WORKED!!. I ran the following command. It took sometime to complete the task. So be patient.
chkdsk /f <Volume_ID>
Here the Volume_ID refers "C:" or "D:" of the corrupted hard disk. eg : 
chkdsk /f D:

Hope this article helped!,

Thanks,
Hemika

[1] - http://askubuntu.com/questions/451364/how-to-enable-exfat-in-ubuntu-14-04
[2] - https://bbs.archlinux.org/viewtopic.php?pid=1481063#p1481063
[3] - http://osxdaily.com/2014/01/27/verify-disk-command-line-mac-os-x/
[4] - http://beshoy.girgis.us/2013/11/solved-error-disk-utility-cant-repair-disk-backup-many-files-possible/
[5] - https://discussions.apple.com/message/24958301#24958301
[6] - http://craigsmith.id.au/2014/07/06/repairing-a-corrupted-mac-osx-exfat-partition/
[7] - https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/fsck_exfat.8.html
[8] - https://discussions.apple.com/thread/4154638?start=30&tstart=0
[9] - https://discussions.apple.com/thread/4154638?start=45&tstart=0
[10] - https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/chkdsk.mspx?mfr=true

Monday, March 23, 2015

Use a Config File for Easy SSH Connections.

Problem ?

When working with Amazon EC2 instances its pretty annoying to connect to the instances using SSH. All the time we have to give the path to the pem file, the username of the EC2 instances, the public DNS for the instance. This is pretty much annoying.

$ ssh -i Key.pem ubuntu@ec2-11-11-11-11.xx-xxxx-xx.compute.amazonaws.com

But there is an easier way that you can store all those variables in a config file an use it to connect the instances from any folder.

Solution

Go to the root directory using "CD".

$ cd

Go the to ".ssh" folder. This folder might already be there.

$ cd .ssh/

Create a file named "config" using an editor. I'll be using VIM.

$ vim config

The config file should contain all our variables for the EC2 instances or where ever you are connecting to. Lets say we have the following EC2 instances.

ID Username Public DNS PEM File Path
instance1 ubuntu ec2-11-11-11-11.xx-xxxx-xx.compute.amazonaws.com ~/.ssh/pems/Key.pem
instance2 ubuntu ec2-22-22-22-22.xx-xxxx-xx.compute.amazonaws.com ~/.ssh/pems/Key.pem
instance3 ubuntu ec2-33-33-33-33.xx-xxxx-xx.compute.amazonaws.com ~/.ssh/pems/Key.pem

In the above table, the ID is a unique value for each instance. You can use any value for the ID. Username is the login username for the instance. Public DNS is the host name for the instance. The PEM File Path is the file path for the identity file.

Using those data we can create the config file content as follows.

Host instance1
    User ubuntu
    Hostname ec2-11-11-11-11.xx-xxxx-xx.compute.amazonaws.com
    IdentityFile ~/.ssh/pems/Key.pem

Host instance2
    User ubuntu
    Hostname ec2-22-22-22-22.xx-xxxx-xx.compute.amazonaws.com
    IdentityFile ~/.ssh/pems/Key.pem

Host instance3
    User ubuntu
    Hostname ec2-33-33-33-33.xx-xxxx-xx.compute.amazonaws.com
    IdentityFile ~/.ssh/pems/Key.pem

After saving the "config" file, you can connect to any of those instances from any folder. If you want to connect to "instance2", it will be as follows.

$ ssh instance2

Happy SSH-ing!