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
250 xxxxx.abc.com.au Hello atheek ([10.152.36.187]), pleased to meet
mail from: email@example.com
250 firstname.lastname@example.org… Sender OK
rcpt to: email@example.com
250 firstname.lastname@example.org… Recipient OK
354 Please start mail input.
subject: SMTP Demo for atheek’s blog
This is a test message for blog
250 Mail queued for delivery.
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.