HowTo Copy a Folder in Linux/Unix

So, I got this question recently from a new Linux user, but I’m pretty sure even people who’ve been using Linux for some time will have a question or two regarding copying files on the command line.

Happy penguins

Unix, and by extension, Linux isn’t known to be very chatty. Most commands are two or at the most three characters long with a hundred options, so a lot of people who’ve come to Linux by way of easy to use distributions such as Ubuntu or Mint have never really used the command line to get done work. I, on the other hand, am an old Linux hand and, frankly, am the most comfortable on the command line.

Continue reading “HowTo Copy a Folder in Linux/Unix”

Stream The Latest BlockBusters For Free Using Popcorn Time

Hollywood has a pretty tight grip on the business of streaming movies and if you’re someone who’d like to watch the latest blockbusters from the comfort of your own couch, you basically have no option but to wait for the theatrical release, even if you’re willing to pay money to companies such as Netflix.

In my opinion, this is the only reason for the massive popularity of mediums such as bittorrent for pirating movies and music. Downloading a good quality print of a movie from a torrent search engine isn’t rocket science but it’s still something that a lot of non-techies don’t know how to do, and they’d be more than willing to pay a fee to the hollywood studios if they’d let them download and see the movies at home. In the absence of any such option, it is natural for people to resort to piracy.

Continue reading “Stream The Latest BlockBusters For Free Using Popcorn Time”

How To Password Protect Files in Linux

The USP of Linux has always been the strong security and stability it offers. Per user/group permissions and ACLs (access control lists) take care of almost all the security needs of a home users as well as an enterprise customer. If there is a need for even more fine grained control, there are various flavors of Linux available that are specifically designed with industrial grade security in mind and certified by organisations such as the NSA.

If you’re a home user, though, all this doesn’t really matter to you. Sure, it helps to have seperate permissions for different users on the system, if you’re sharing your computer with, say, your sibling, but configuring ACLs for home a user is a little overkill, if you ask me.

If all you need is a way to password protect certain important files from the prying eyes of your siblings, kids or pesky neighbors, Linux doesn’t offer anything *out of the box*. Fear not, though, we have just the right tool for you.

Password Protect Files

mcrypt is a utility designed to encrypt/decrypt a file using standard encryption techniques. If you don’t have mcrypt installed, you can install it with the following command.

apt-get install mcrypt

To password protect a file execute the following command

mcrypt <filename>

The above command will output something like this.

khera@khera:~$ mcrypt test1
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase: Enter password here
Enter passphrase: Repeat password here

File test1 was encrypted.
khera@home:~$

By default, mcrypt creates a new encrypted file with the extension .nc added to the original filename and leaves the original file intact. If this is not what you want, and you’d rather not have any traces of the original file, use mcrypt with the “-u” option.

mcrypt -u <filename>

This will ask you for a password as usual and the only difference will be that when the command finishes executing, the original file, test1 in the above case, will be deleted.

Decrypting a Password Protected File

So, now you know how to password protect file but what about decrypting it.

Turns out mcrypt does that too. Just use mcrypt with the “-d” option and it will decrypt the file for you after confirming the password with you.

mcrypt -d <encrypted filename>

The output should look something like this

khera@khera:~$ mcrypt -d test1.nc
Enter passphrase: Enter password here
File test1.nc was decrypted.

Like, in the encryption phase, mcrypt doesn’t delete the original file by default and if that is what you want, use mcrypt with the -u switch.

mcrypt -u -d <encrypted filename>

This will decrypt the file and delete the original encrypted file leaving no traces of it on your computer.

How was that for an easy encryption/decryption utility?

How To Test The RAM On Your Computer

The RAM is arguably the most important part of your computer. Apart from the processor, of course, but without some kind of memory, even the process is pretty much useless. A computer, without RAM, cannot run any application that you tell it to and might as well be a dead paper weight.

If you’ve noticed unusual freezes and random operating system/application crashes on your computer, the RAM should be your first line of diagnosis. The RAM on a modern computer is composed of millions of cells that store the data for the computer to process and failure of even a single cell can cause weird errors that can be extremely difficult to diagnose.

Memtest is an open source utility that verifies the RAM installed on your computer for any defects. Since, this is an open source tool, there are versions available for practically every operating system and I’m going to use the Mac OS X version of memtest today since that is what I’m most familiar with. You should be able to use the same command line switches with the version of memtest available for your operating system.

Download MemTest For Free

Memtest is available as a free download so just download it to your computer and unzip the file. You should now have a .pkg installer that you can just double click to install memtest. This installer does nothing other than installing the memtest binary to /usr/bin.

To start testing the RAM on your computer, launch Terminal.app and execute memtest.

Sharninders-iMac:~ sharninder$ memtest all 1

The above command will make memtest run through it’s complete test suite once. In general, it is better to test at least twice, or even let it run for a few hours if you want to be completely sure. If you don’t specify any number after the “all”, memtest runs indefinitely and will have to be stopped by pressing the ctrl+c key combination manually.

If Memtest throws up an error or memtest itself freezes, you’ll know for sure that the RAM is bad. If not, well, time to start diagnosing other parts of the computer.

Memtest for PCs

If you’re not running a Mac, you can still use memtest to diagnose the RAM of your PC, though the process is a little different. For PCs, memtest is distributed as images that you can burn onto CDs or USB flash drives.

Download one of the many pre-built images and burn it to a CD or to a USB flash drive, depending on the image. Now, shutdown your computer and reboot it using the CD/USB Key that you just burned. That should start Memtest straight away. Let the diagnostics run for a while or till you’re sure that the RAM has been tested thoroughly.

Have you ever had the RAM in your computer go bad ? How did you diagnose it ?

 

How to read HFS+ volumes on Windows

HFS Explorer I’ve been using an OS X Leopard (That’s 10.5) machine at work since the last few days for a project that I’m working on. I’ve been a Unix user for a long time so I’m pretty comfortable with the Unix side of OS X including the file system and the BSD underpinnings.

For those who haven’t used OS X, it uses a proprietary file system called HFS+ as the default file system. Because it is a proprietary file system and Apple hasn’t really released any specs for it yet, there aren’t too many utilities to read or write to HFS+ volumes (That’s what Apple calls their partitions) from operating systems other than Apple’s own.

Why would I want to do that ? Well, I normally wouldn’t … but yesterday I was in a hurry to get back home from work and needed to copy some files from the OS X machine so that I could work on them at home. What I forgot in a hurry was that the USB stick that I was using had been formatted as an HFS+ volume. I came home and plugged in the USB stick to my home PC and waited and waited for it to get recognized. Windows recognized the stick but refused to read it. That is when I realized my mistake.

I searched online for tools which would let me get my data off the flash drive and let me work on it from my Windows machine.

HFSExplorer is one such small utility designed to do  that.

You can choose to download either the Windows based Installer or the standalone zip file. I chose the zip file, downloaded and extracted the contents to a folder on my PC and plugged in the flash drive that I wanted to read the data from.

HFSExplorer

Continue reading “How to read HFS+ volumes on Windows”

Download youtube videos to your computer on Linux

YouTubeYoutube is by far the most popular site for sharing videos. The only problem with uploading your videos to youtube is that there really is no easy way to download those videos back to your computer. Your only option than is to view them online. There are also times when you watch a video so hilarious/interesting that you want to keep a copy for your own use.

To get over these restrictions, a lot of people have written really neat utilities which let the user download videos directly from the site. In this post, we’ll be talking about one such utility for Linux.

Youtube-dl

Youtube-dl is a console only application which is the simplest utility I’ve found till now for downloading videos from youtube.

To install youtube-dl, if you’re using Ubuntu, use apt-get.

apt-get install youtube-dl

Now, using a browser, browse to the video that you want to download. Copy the URL of the video page.

Now, at the console, give the following command.

youtube-dl <URL of the video>

Youtube-dl

That’s all. youtube-dl will now download the video to your computer and save it in the default .flv format which Youtube uses to save it’s videos. FLV files can be easily played back on Linux using the excellent VLC media player.

How to create a secure and private network

hamachiPicture this – You’re out on the road for work or pleasure and have this sudden urge to listen to that one song from your collection which is stored on your desktop back at home. Or you’re a freelancer and need access the draft proposal you made for a client which is again on your desktop sitting in your home office.

You can’t keep your desktop or other machines at home exposed to the outside world over the Internet, because, franklt speaking, it’s a dangerous world out there. But you still need safe and easy (and secure) access to all your data. How do you do that ? Did someone say – “Create a VPN!”

Enter Hamachi.

Continue reading “How to create a secure and private network”

How to schedule tasks in GNOME using gnome-schedule

gnomeMost Linux/Unix veterans use cron to schedule tasks on their machines and it is a very powerful utility for what it does.

The problem with cron is the cryptic syntax which tends to scare away most new users and the fact that a user has to use the terminal to create a new job.

In this tutorial we will explain how to use a graphical front end to cron, called gnome-schedule.

Continue reading “How to schedule tasks in GNOME using gnome-schedule”

Elisa – Open Source Cross platform Media center

Elisa media center Ellisa is an open source media center that can play DVDs, VCDs, video files and even display your photos. The support for video files is extensive and the player can handle almost any video that you might throw at it.

Elisa is extensible and is based on a very neat plugin architecture, which means that if there are features that you miss from the default install, they’re usually just a plugin away.

In the true spirit of open source, Elisa is available for both Linux and Windows with a Mac OS X port on the way.

Continue reading “Elisa – Open Source Cross platform Media center”

Play Space Invaders in Openoffice Calc

OpenOffice LogoWho said open source developers were a boring bunch of people. I’m quite sure that person hasn’t met the developers of Calc.

For those of you who’ve been living under a rock until now, Calc is the Spreadsheet part of the OpenOffice.org suite and today we are going to unearth a very cool easter egg game programmed within Calc by the developers.

Open a Calc Spreadsheet and type =GAME(“StarWars”) into any cell. The text should be typed exactly as written.

Continue reading “Play Space Invaders in Openoffice Calc”