Linux



Published June 18th, 2007 by admin

Adding Terminal Aliases to Ubuntu


If you spend any time at all in the terminal you will soon discover that re-typing common commands gets old very quickly.

Linux has come up with a great solution to an age old problem.

The alias command.

This command allows you to create an alias or shortcut if you will to calling a longer command.

Let’s say you vnc another machine a lot. That machine happens to not have a DNS host name associated with it. You are always trying to remember the IP of that machine so you can VNC it.

The command to VNC our imaginary machine goes something like this:

vncviewer admin@192.168.245.231

That is a lot of typing for a common task.

Let’s simplify that. Type the following:

alias vncmybox=’
vncviewer admin@192.168.245.231′

Now you have created your first alias. Anytime during the session you type vncmybox it will run the command we assigned to that alias.

Here is the catch, as soon as you close the terminal all is lost.

Let’s make this change permanent.

Go to you home folder and create a file named:

.bash_aliases

(This can also be done via the terminal like so:

touch ~/.bash_aliases

Then add the alias we created earlier on the first line of this text file as so: (Remember to open this file from your home folder you will have to show hidden files by pressing ctrl + h when in your home directory)

alias vncmybox=’vncviewer admin@192.168.245.231′

Save the file and open the file named:

.bashrc

Find the section that is commented out (lines preceded with #’s) to looks like this:

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Uncomment those lines. Save and close and then open a new terminal window.

Now type:

alias

It will list your aliases including the one we just added. Now you can go back and add other commonly used commands to your .bash_aliases file to ease your terminal tasks.

Technorati Tags: , , ,

Published May 30th, 2007 by admin

How to Unzip a Directory Filled with Zip Files

I know I find myself in this predicament quite often. I download a bunch of new WordPress themes or any other collection of zip files and place them into a folder.


Then I want to unzip all of them into their respective folders in one swift motion.

The code to do so from the terminal?

First browse to the directory containing all the zip files and then issue this command:

unzip \*.zip

Simple huh?

Technorati Tags: , ,

Published May 23rd, 2007 by admin

How to refresh Gnome Panel

Sometimes you may run into a pickle where the desktop becomes unresponsive.

To heal this predicament type at the Terminal:

killall gnome-panel

This will restart Gnome desktop.

Technorati Tags: , ,

Published May 22nd, 2007 by admin

Correct syntax for using SSH and SFTP on irregular ports

This is a little more advanced than the last few topics but I want to appeal to all Ubuntu/Linux users over time and not just beginners…

So without further ado, here is a few ssh syntax tips (this also applies to most versions of Linux):

 (replace items in < > with your stuff, without the < >)

SSH:
ssh -p <port number> <username>@<server name>

SSH to accept socks 5 proxy on port you specify:
ssh -p <port number> <username>@<server name> -D <port to watch>

SFTP:
sftp -oPort=<port number> <username>@<server name>

Forward the X server from your remote box:
ssh -X -p <port number> <username>@<remote computer>

Technorati Tags: , , ,