Monday 4 March 2013

Extract tar tar.gz tar.bz2 files linux command

get asked this all the time, so here are the most common extract commands.

Extract the contents of "filename.tar" 
Command: tar -xvf filename.tar 

Extract the contents of "filename.tar.gz" 
Command: tar -zxvf filename.tar.gz 

Extract the contents of "filename.tar.bz2" 
Command: tar -jxvf filename.tar.bz2

Sunday 3 March 2013

mac terminal cd to network drive

You may have a nas drive, or any drive that is accessible through finder, but you would like to 'cd' to it in the terminal, perhaps to issue some git commands.

Here is how to do this..

1. First of all, in finder, look under the SHARED list, whatever your drive is called there is what you will use in the coming command. For this example, I will assume your network drive is named: nas-fe-29-23

2. We will be mounting a specific directory on that share, for this example, I will assume that directory is named "code". (//nas-fe-29-23/code)

3. Create an empty directory wherever you like, this will be turned in to the drive. To make that clearer, when you use the command to mount the drive which we will do in a few lines, it needs a directory to use as the mount point for your network share, dont worry, all will become clear.. For this example, ill assume you have created an empty folder in your home directory: ~/MyNewDir

4. Open terminal, and type the following command:

mount_smbfs //username:password@nas-fe-29-23/code ~/MyNewDir

When you press enter, the drive will be mounted. If you look in finder, the "MyNewDir" directory that you created, will now look like a drive and not a normal dir. It will also be given the same name as the network directory that you chose, so in this case "code".

Now in terminal you can cd ~/code

Have fun!