Sunday, March 28, 2010

How to know the status of all the running services

There are many commands like netstat -plant,ps -aux but when you want to know all the services which are running presently into your RHEL box, service --status-all command is very handy . It shows all the running services into your box.

Quit from shell without saving into history

There are many instances when we want to quit from shell without saving any command in history. We might have run by mistake some rookie command and you dont want to disclose it to others.

kill -9 $$ will do the needful as $$ will provide the PID of the current shell.

Saturday, March 27, 2010

Keyboard shortcuts for shell

Some useful and more often used keyboard short cuts in bash shell under Mac

1)CTRL + A Move to the start of the line.

2)CTRL + E Move to the end of the line.( e for END)

3)CTRL + W Delete word backwards

4)CTRL + U Delete whole line backwards.(Delete from the cursor to the beginning of the line,If cursor is at the end of the line, it will delete the whole line) It can also be used to delete whole line if you are at the end of the command and you wish not to execute it.

5)CTRL + k Delete from the cursor to the end of the line.(Delete WHOLE LINE,if the cursor is in the starting,it will delete whole line)
Place the cursor in the right place and press Either U or K to delete rest of the line

6)CTRL + R to Search history. Press escape to verify and enter to execute

7)CTRL + L To clear line leaving the last line on the screen.

Saturday, October 3, 2009

Some useful vi commands

gg -- Start of file
G -- End of File

^ -- Start of Line (Numeric 0 also work)
$ -- End of Line
w -- move forward word by word (Sometime use capital W to move forward,e also works)
b -- move backward word by word
3G -- will move to 3rd line
o(Alphabet) -- Insert into Next line
Page up and Page down works great

* -- Read the string under the cursor and go to the next place it appears.
(For instance, if your cursor was somewhere on the word "bob," the cursor
would move to the next occurrence of "bob" in your file.)

# -- Same as above but in reverse order

u -- undo .. Press successively if required.

U (Capital) -- Undo all changes in the line

typing . (a period) -- will repeat the last command you gave.
For instance, if your last command was dw (delete word), vi will delete another word.

Counts are one of the most powerful and time-saving features of vim.
Any command can be preceded by a number.
The number will tell vim how many times to execute the command. Here are a few examples:

3j will move the cursor down three lines.

10dd will delete ten lines.

y3f" will yank (copy) text from the cursor to the third quotation mark after
the cursor on the current line. Counts are useful to extend the range of a motion in this manner.

F -- Move one screen forward
B -- Move one screen backward

H -- Move the cursor to the top of screen -- Page UP
L -- Move the cursor to the bottom of screen -- Page Down

Saturday, July 18, 2009

Nagios Video

Nagios Introduction




Deployment Scenario



Nagios Monitoring

Sunday, April 19, 2009

Just opened binary file in vi !!!!!!!

By mistake,you have just opened one binary file in vi and screen continues to scroll. You may use CTRL + C to stop that. But now,junk characters are appearing in prompt. You are not able to read anything.Try reset command. It will Reset scrambled screen.

$reset


To test this command try opening some binary file and issue reset command after stopping scrolling by pressing CTRL + C.

How to see what others are doing in real time ?

There are some situation when you are only interested in knowing what others are doing.
Let say two guys are trying to fix a server and as a supervisor, you are interested in knowing how they are doing in real time.

You may do this using script command. Let say person is logged in and his terminal type is pts/0. Running "w" tells this.

script -f /dev/pts/0


This tool is good for learning from team member's skill.