I came across this simple script on ubuntuforums which I thought was really very useful and worth sharing it on my blog. You can either make a function out of it and put it in .bashrc file or make an executable script and put it in /usr/bin/.
Method 1:
Open your ~/.bashrc file using any editor.
gedit ~/.bashrc
Copy and paste the following code at the end of it:
extract-file (){if[-f $1] ; thencase $1in*.tar.bz2)tar xjvf $1;;*.tar.gz)tar xzvf $1;;*.bz2)bunzip2 $1;;*.rar) rar x $1;;*.gz)gunzip $1;;*.tar)tar xf $1;;*.tbz2)tar xjvf $1;;*.tgz)tar xzvf $1;;*.zip)unzip $1;;*.Z) uncompress $1;;*.7z) 7z x $1;;*)echo"'$1' cannot be extracted via extract-file";;esacelseecho"'$1' is not a valid file"fi}
Now you can use the following command to extract any archive:
extract-file
The command extract-file would be available only to terminals which have been opened after saving the .bashrc file with the above code. Also this code is user-specific, so if another user logs in he cannot use this command.
Method 2:
Use the following command to create a new file in /usr/bin directory and launch the gedit.
There are lots of commands to find out your ditribution name and distribution version. Some work on some distros, some work on others. Here are some of the methods:
lsb_release -a
cat /etc/*release
cat /etc/issue
cat /proc/version
uname -a
One of these methods will surely tell you your linux distribution name and current version.
Today I experienced a rather strange problem in Ubuntu. It crashed. Actually it wasn’t completely crashed, the mouse clicks weren’t working, I couldn’t switch using Alt+Tab, I could only use the program which was on the screen. The panels weren’t working, though the shortcut keys were. Fortunately enough, I had assigned shortcut key to open the terminal and it was working, so I could even access the terminal.
Fortunately, firefox (shiretoko) was running as the frontmost application and I was able to access the internet. I searched for How to kill X and was presented with many solutions.
I tried killall X in terminal but it didn’t work. Suddenly, I remembered that X was called Xorg in jaunty. I did this:
Well all OSes have bad programs, Linux has it too. Some times they stop responding and unlike windows, they don’t make the whole OS unresponsive. The application alone is unresponsive but you can still use other applications normally. Killing an unresponsive application is fairly easy job in Ubuntu.
Bring the unresponsive application to the front, the app must be having a desaturated look because its unresponsive (if its not, check again… it must not be unresponsive). Launch the terminal and type:
$ xkill
The mouse cursor will change to a cross, click anywhere on the unresponsive application and it will be killed.
To get things done faster, you can type xkill in “Run application” dialog box too. Press Alt+F2 to bring the run dialog box and type xkill and enter. The mouse cursor will change to cross and click on unresponsive app to kill it.