Categories

Our Sponsors

Find processes and what network ports they use on Solaris 10

Show all of the processes and any open ports that they may be using.

for pid in `ps -aeo pid | grep -v PID`; do sudo pfiles ${pid} | egrep “^${pid}:|sockname:” done

Once you know the PID’s of the processes you can determine all of the atributes of the applications using pargs, instead of ps. [...]

Share

Launch Application from Excel

I started out with the need to be able to launch a putty SSH window from Excel that had a list of hosts and/or IP addresses.

In Microsoft Excel

1) View/Toolbars Visual Basic 2) Click the Control Toolbox icon 3) Click on the Command Button icon and then click in your worksheet or drag the [...]

Share

Unix Terminal Headers and Titles

Please see another post of mine about terminal colors if this post is a little confusing.

Add the following to your .kshrc or .bashrc files.

# KSH terminal headers add to .profile PS1=`uname -n`” $ ” alias cd=_cd function _cd { \cd ${1+”$@”} && echo “\033]0;${USER}@${HOST}: ${PWD}\007\c” }

# BASH terminal headers add to .bashrc [...]

Share

Too many processes script

KSH script to check the number of processes on a system and send an email if there are too many.

I liked this as it was simple, but had some nice elements that could be used elsewhere.

#!/bin/ksh # # Script to check for run away ftp processes. # 04/08 – Mike Byers

HOST=`uname -n` [...]

Share

Command Line Search and Replace

So you want to change some text in many unix files.

Try the following.

perl -pi -e ‘s/find/replace/g’ *.txt

or to script it out. Find the TEXT in regular files and replace with NEWTEXT

for file in `find ./ -type f -exec grep -l TEXT {} \;` do perl -pi -e ‘s/TEXT/NEWTEXT/g’ $file done

[...]

Share

Unix Terminal Font Colors

You can set the font color on the command line if you so desire.

To start, type this on your console:

echo “^[[0;31;40m In Color”

In Color

The first character is an escape character, which looks like two characters, ^ and [. To be able to print this, you have to press CTRL+V [...]

Share

Unix, Web and Development Cheat Sheets

There is a very good list of cheat sheets located at

http://www.petefreitag.com/item/455.cfm

Share

Adding Application to Gnome

I’m sure it’s much much easier than this now, especially with Ubuntu Linux.

I wrote this a couple of years ago, but should keep it around just in case.

Use a text editor like vi (my favorite) or nano to create a .desktop file for the entry in /usr/share/applications. I named mine thunderbird.desktop. (sudo vi [...]

Share

Changing SUDO insults

The sudo command comes with some fun insulting messages when you mistype your password.

In you sshd.conf you need to have “insults” turned on for them to show up.

I started to think that there must be a way to change the insult messages. For instance at home I may want more, non-politically correct insults [...]

Share

SSH Tunneling How-To

First there are a couple scenarios for the tunnel.

Out_host -> Gateway -> Other_host

In this sense you want to get to the other host or to a port on another host.

Use: ssh -L local_listen_port:gateway:gateway_port Other_host

Remote forwarding is used to skip past systems to a destination. You can then use the ssh -p [...]

Share
Get Adobe Flash playerPlugin by wpburn.com wordpress themes