About Me

My photo
Working as Technical Lead in CollabNET software private limited.

Thursday 27 March, 2008

Mastering VI


D
To delete remaining characters under cursor in current line.
dd To delete entire line and copy to clipboard
$
Move the cursor to the end of the current line.
C-g To display filename and number of lines in end of the terminal
r To replace single character under cursor
R To replace multiple character under cursor untill escape is pressed
dw To replace a word under cursor

Mastering Bash


C-a
Move the cursor to the beginning of the input line.
C-d Same as [DEL] (this is the Emacs equivalent).
C-e Move the cursor to the end of the input line.
C-k Kill, or "cut," all text on the input line, from the character the cursor is underneath to the end of the line.
C-l Clear the terminal screen.
C-u Kill the entire input line.
C-y Yank, or "paste," the text that was last killed. Text is inserted at the point where the cursor is.
C-_ Undo the last thing typed on this command line.
[] Move the cursor to the left one character.
[] Move the cursor to the right one character.

To resize image for thumbnail in linux

Need the thumbnail, Here is the utility I used..

First install the imagemagic
sudo apt-get intsall imagemagic

Use convert command to make your thumbnail.

Here 200 is the
200px width
convert -thumbnail 200 DSC01536.JPG DSC01536_thumb.JPG

Here x200 is the
200px height
convert -thumbnail x200 DSC01536.JPG DSC01536_thumb.JPG

< CRTL > + r for Search in terminal command line

"This is used to search already executed command in Linux terminal."

We waste timings by retyping the command often for a small argument changes. But this is not worthy, Hmmm you can use CRTL + r to searching the already executed commands.

USAGE:
Press CRTL + r and enter text to match the already executed command. Matching results will be dispalyed, so now you can reuse them.

Wednesday 19 March, 2008

To Alter MAC address in windows, linux

I heard that we can't use some internet broad band connectivity expect the specific system as it's bounded to that specific MAC address.

Hmmm, the above raised a question? how to use that in other laptop etc...

Got a suggestion, Why can't you change your machine or laptop's MAC address matching the original bounded MAC address.

To Change MAC address in windows!

Go to,

Settings > Network Connections > local area connection > General Tab > configure > Advanced > Locally Administered Address > value.

Give the value , MAC address of bounded machine.

To Change MAC address in linux!

ifconfig eth0 down

ifconfig eth0 hw ether 00:00:00:AB:AC:AA

ifconfig eth0 up

This will use the mac address temporally to browse!.

Tuesday 11 March, 2008

About Zenity, a linux command.

Need GTK+ support for the command or shell. Yes this is the right command. It's almost belong to similar family like Xdisplay, display, cDisplay.

Try this, it's awesome. I do no whether it's inbuilt in redhat but it's there in ubuntu.

Some quick cracks on that.

To get the calendar !
zenity --calendar
To get the input from the user !
zenity --entry
To get Yes or No
zenity --question --text "Do you need to proceed reading?"

Use the ouput of the above command to input of another command using echo $?.

The echo$? returns status of the previous command.

answer=`zenity --question --text "You appear to have an AMD64 architecture. Do you want to install the 64-bit version of Songbird?"; echo $?`

if [ $anw = 0 ] ; then
....
....
....
fi

I've missed this command lot or else I would've used in most of my scripting languages to get the user inputs :)

Friday 7 March, 2008

GNU Screen && nohup

These commands are useful to run commands even after closing ssh.

screen -
when you need to run the process in background with the terminal alive for further process or monitor

nohup - when you need to run the process in background with out control over the process or the monitor.

Commands for screen

To start the new screen
screen

To detach from the screen with out exiting the session
Crtl a + d

To reattach to the default first screen
screen -r

If more than one screen listed then select the appropriate screen using

screen -x {pid/name}

Command for nohup

nohup command

Tuesday 4 March, 2008

Hibernate it's not "Hibernate in Action"

I was little bit eager to find why my windows OS doesn't consume power and it's not same in case of ubuntu OS during my laptop is idle.

Then the reason came out is because of "Hibernate", Yes there is an Hibernate function in windows xp which makes the batteries live longer. Then I've used the Hibernate function in ubuntu too and it made it as expected!!!!.

VPN configuration in Ubuntu

Recently I've configured the VPN for first time and here are
some commands related to it.

Install VPNC
sudo apt-get install vpnc
cd /etc/vpnc/
sudo ls /etc/vpnc

Configure VPNC

sudo vim /etc/vpnc/example.conf
sudo mv /etc/vpnc/example.conf /etc/vpnc/default.conf
sudo vpnc
sudo vim /etc/vpnc/default.conf

To start VPNC

sudo vpnc

To Disconnect VPNC

sudo vpnc-disconnect
ps ax|grep network

Restart Network
sudo /etc/init.d/networking restart
ping yahoo.com