Linux / Unix commands tips....

vishal sharma's Avatar author of Linux / Unix commands tips....
This is an article on Linux / Unix commands tips.... in Unix.
I have been using linux for 2 years now, and I can tell you that I learn something new virtually every day. And a few of those things I have learned are very rare to be seen all the time. Here are a few of them.

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.

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:

# mkdir

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
0
kunwar_salim's Avatar, Join Date: Jan 2007
Newbie Member
hi its kunwar saleem
0
kunwar_salim's Avatar, Join Date: Jan 2007
Newbie Member
hi its kunwar saleem
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by kunwar_salim
hi its kunwar saleem
Welcome to the forum and we have a section for introducing yourself and its better if you dont do this as a comment to the articles and keep the comments relative to the articles.
0
clocking's Avatar, Join Date: Jun 2007
Ambitious contributor
oh, Using C program with file .dll in Linux OS. How many library in Linux OS?
0
micman's Avatar, Join Date: Jan 2008
Go4Expert Member
Excellent !
0
kunjire's Avatar, Join Date: May 2008
Newbie Member
Thanx buddy
0
mma007's Avatar, Join Date: Jun 2010
Newbie Member
nice useful Linux / Unix commands tips.