Harry Sukumar's Weblog

Archive for May, 2008

View Live log on the Linux

Posted by hsukumar on 30/05/2008

This command pretty much works for all the flavours of linux

tail -f /var/log/messages

tail -f /path/file.log

this is very similar to watch command :)

Posted in CentOS, General Linux, Redhat MIX, VMWare | Leave a Comment »

Bash Short Cuts( Hotkeys)

Posted by hsukumar on 30/05/2008

Ctrl + A

Go to the beginning of the line you are currently typing on

Ctrl + E

Go to the end of the line you are currently typing on

Ctrl + L

Clears the Screen, similar to the clear command

Ctrl + U

Clears the line before the cursor position. If you are at the end of the line, clears the entire line.

Ctrl + H

Same as backspace

Ctrl + R

Let’s you search through previously used commands

Ctrl + C

Kill whatever you are running

Ctrl + D

Exit the current shell

Ctrl + Z

Puts whatever you are running into a suspended background process. fg restores it.

Ctrl + W

Delete the word before the cursor

Ctrl + K

Clear the line after the cursor

Ctrl + T

Swap the last two characters before the cursor

Esc + T

Swap the last two words before the cursor

Alt + F

Move cursor forward one word on the current line

Alt + B

Move cursor backward one word on the current line

Tab

Auto-complete files and folder names

Posted in CentOS, General Linux, Redhat MIX, VMWare | Leave a Comment »

VNC Setup

Posted by hsukumar on 28/05/2008

Here I will try to explain how to pull the entire desktop using vnc

Here we have 2 machines 192.168.1.1 ( Server ) and 192.168.1.2 ( client)

to pull the gnome desktop from 1.1 to 1.2 here is the steps you follow

log into server as user(harry)

# run the following command

$vncpasswd- type the password twice and you are done

$ edit /etc/sysconfig/vncserver as root

add yourself to the VNCSERVERS list
i.e. VNCSERVERS=”1:sb 2:emma 3:harry”
and add the following line
VNCSERVERARGS[3]=”-geometry 1152×864 -nolisten tcp -nohttpd -localhost”
After this is done save the file and restart vncserver
$service vncviewer restart
4. edit ~/.vnc/xstartup
comment out: twm &
add the line: exec gnome-session &
example of the file that should work
[harry@localhost ~]$ more .vnc/xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
#twm &
exec gnome-session &

Run the login script from the client (192.168.1.2)
$ mkdir /home/harry/scripts
$ vim /home/harry/scripts/vncscript
ssh -f -L 25903:127.0.0.1:5903 harry@192.168.1.1 sleep 10; vncviewer 127.0.0.1:25903:3
First it asks for your ssh/login password and then vncviewer asks for your vnc password.
Please note that the number 25903 are local machine port number but the server port number is 5903 and if in your case it is some thing then change the last digit of 127.0.0.1:25903:3 that is you can see :3 and 5903 are the same in case it was 5904 then you have to add 127.0.0.1:25903:4
Hope I have made it simple for you guys to understand
All the best :-)

Posted in CentOS, General Linux, Redhat MIX | Leave a Comment »

ESX Server- Cloning VM’s without Virtual Center!!!

Posted by hsukumar on 14/05/2008

If you would like to clone virtual machine on esx server without the help of virtual center here is the instruction to do so

log into esx server

su to root and type the following command

$ vmkfstools -i /vmfs/volumes/datastore/sourcevm/sourcevm.vmdk /vmfs/volumes/datastore/destvm/destvm.vmdk

this will clone the virtual machine from source to destination

once you have finished cloning

go to vi client and run file->new virtual machine

use custom instead of typical

give the same name as the destination virtual machine name

use next next until you get to point where it ask’s you for select disk change it to use an existing virtual disk and specify the path to .vmdk file

and click next and next and finish this job

Now you should be able to turn on the machine with out any issues

Hope this works for you :)

Posted in VMWare | 2 Comments »

Zip Folder or file on Linux Machines :)

Posted by hsukumar on 13/05/2008

zip -9 -r <zip file> <folder name>

To zip a single file:

zip -9 <zip file> <filename>

Use “-9″ for best compression. The compressed file works fine with Windows XP compression tool.

Posted in CentOS, General Linux, Redhat MIX | Leave a Comment »