Archive for July, 2011

Using tar in Ubuntu

tar is pretty common command for archiving the files in Linux. It is pretty much the same across the distributions. You can type in the commands listed below in the Ubuntu terminal window.

Of course you can do:
man tar

and see all the flags and how to use, but hopefully this post will save you the effort.

To create an archive I usually do:
tar czf directory_name.tar.gz directory_name/

where “c” means create, “z” for gzip compression and “f” for file.

You can also do:
tar cjf directory_name.tar.bz2 directory_name/

for bzip compression or just:
tar cf directory_name.tar directory_name/

for a regular .tar

Basically, we specify the command with flags, type a file name that we want to create and pick a directory or file that we want to add to archive. These commands create an archive leaving the directory untouched.

 

Similarly, we extract these types of files using the “x” flag like this:
tar xf directory_name.tar
tar xzf directory_name.tar.gz
tar xjf directory_name.tar.bz2

That’s it.

How to use windows key to open Start menu in Ubuntu

The default short cut to open the “Start” panel in Ubuntu is “Alt+F1”, however you may wish to change it to the windows key. If you want to change it to something other than windows key, a combination of keys for instance, you would go to System > Preferences > Keyboard Shortcuts and click on “Show the panel’s main menu”, then, once selected just press they keys you want to use.

However, it doesn’t seem to do anything when you press the windows special key. In order to use it, you would have to open the terminal window or Run Application window (Alt+F2 by default) and execute this command:


gconftool-2 --set /apps/metacity/global_keybindings/panel_main_menu --type string "Super_L"

where Super L is the left “Super” key, which is left windows key.

How to open .rar files in Ubuntu

You need to install unrar to open .rar files in Ubuntu. It’s pretty easy, just open a terminal and type:


sudo apt-get install unrar

Now either double click the .rar file in GUI or right click -> Extract here. You can also type the following command in terminal:


unrar x /path_to_file/file_name.rar