Some Linux TIps and tricks

1.  If you are using Redhat’s netcfg utility to connect to the internet and you are sick of having to open up the GUI, and click on ACTIVATE to connect, and then have to click on DEACTIVATE to disconnect… here is one little thing that you can do to make life easier.

Let’s say you have a ppp0 set up with netcfg. Just add this two lines to your /etc/bashrc
alias dial=”/etc/sysconfig/network-scripts/ifup-ppp /etc/sysconfig/network-scripts/ifcfg-ppp0″

alias hangup=”/etc/sysconfig/network-scripts/ifdown-ppp /etc/sysconfig/network-scripts/ifcfg-ppp0″

Now if you want to connect, all you need to do is to go to your terminal and type dial; if you would like to disconnect just type hangup.

2. Here is another cool thing for you guys that use bash.

Let’s say you want to create a new directory called test

And you type:

# mkdri

Note that the command is mkdir, not mkdri. Instead of backspacing to fix this typo, go ahead and hit Ctrl+t (simultaneously). It will swap the two letter and you have your command fixed.


Also for you guys that are using bash.

Don’t you hate when you want to go from one directory to another, but the directory is a 200-letter name? Let’s say you wanted to go from your current directory to the directory what_is_wrong_with_this_directory.

# cd what

Now, go ahead and hit the TAB key. This will make the shell look through your paths and find the possibilities that starts with what.

Note: If you hit tab once and nothing happens, hit it twice, because if there is any other directory that starts with the word what then the shell would not know to what directory to go to.


Customizing your directory colors.

I know a lot of you know the command ls –color. Which displays your directory with colors. But, a lot of people may not know that those colors are customizable. All you need to do is add the following line to your /etc/bashrc file.

eval `dircolors /etc/DIR_COLORS`

And then all of the color configuration can be found in the file /etc/DIR_COLORS


Frozen Xwindow.

If your Xwindow freezes sometimes, here are two ways that you may try to kill your server. The first is the simple simple way of killing your X server the key combination: Ctrl+Alt+Backspace

The second way is a little more complicated, but it works most of the time. Hit Ctrl+Alt+F2 to startup a virtual console, then log in with your user name and password and run:

# ps -ax | grep startx

This will give you the PID of your Xserver. Then just kill it with:

# kill -9 PID_Number

To go back to your first console, just hit Alt-F1


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: