Some useful stuff !

Some useful stuff which I use as a reference for work.

Process Listening at a Port (Windows)

Have you ever felt the need to know which process is listening at a particular port on a windows machine? The windows version of netstat has a cool option to do this[ “-O”], similar to what lsof (lsof -i : port number ) can provide in Unix.

C:\>netstat -nao| find “LISTEN”
TCP 0.0.0.0:21 0.0.0.0:0 LISTENING 1756
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1832

The last column gives the id of the process listening at the port. Process 1756 above is the Filezilla ftp server which listens to the ftp port 21.

To view the process name just hit ctr+alt+del and select task manager.If PID column is not available in task manager then go to View –> Select Columns and check PID.

This will be useful if you want to kill a particular instance of weblogic server , when you have multiple servers running on the machine , a typical scenario in development environments.

Unix Shell – Easier Navigation

Found this very useful tip which could make working with Unix shell a very pleasant experience.

Add the following to the .profile file in your home directory:

set -o emacs
alias __A=`echo “20″` # up arrow = ^p = back a command
alias __B=`echo “16″` # down arrow = ^n = down a command
alias __C=`echo “06″` # right arrow = ^f = forward a character
alias __D=`echo “02″` # left arrow = ^b = back a character
alias __H=`echo “01″` # home = ^a = start of line
alias __P=”^P”

And voila!, you can use up/down arrows to navigate through the command history, left/right to move back and fro tthrough the command line, backspace to do what it is supposed to do and so on very similar to what you get on a windows command line.

Works with ksh. Not tested with others.

Sending mail via Telnet

If you have connectivity to a valid SMTP relay server, then you can send a mail via a telnet session:

See below a sample telnet session started with a telnet <smtp server host> <smtp server port>

Commands in red are entered by the user


220 xxxxx.abc.com.au ESMTP Service (Lotus Domino Release 7.0.3) ready
at Thu, 27 May 2010 12:35:25 +1000
helo atheek
250 xxxxx.abc.com.au Hello atheek ([10.152.36.187]), pleased to meet
you
mail from: atheek@gmail.com
250 atheek@gmail.com… Sender OK
rcpt to: atheek.rahuman@abc.com
250 atheek.rahuman@tcs.com… Recipient OK
data
354 Please start mail input.
subject: SMTP Demo for atheek’s blog
This is a test message for blog
.
250 Mail queued for delivery.
quit
221 Closing connection. Good bye.

This blog shows how to use telnet to receive mails from an imap server.

This is useful when you want to troubleshoot issues in email integrations in OSB or SOA Suite.

Advertisements

About atheek

I am a Weblogic consultant working in Middleware/Integration area.
This entry was posted in General and tagged , , , , . Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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