Your Ad Here

Senin, 13 September 2010

Unix Tip: FILES OPENED BY A PROCESS

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3504 - September 13, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


FILES OPENED BY A PROCESS

This is supported on Sun
Solaris, not too sure about
other Unix flavours.

I badly wanted to find out
all the files opened by
a process, and that is
when I found pfiles.

Usage :
/usr/proc/bin/pfiles <pid>

Where pid is the process-id
of the process.

It lists the inode numbers
of all the files, opened
by that process.


This tip generously supported by: mdhar@miel.mot.com


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Minggu, 12 September 2010

Unix Tip: MULTIPLE IP ADDRESSES

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3503 - September 12, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


MULTIPLE IP ADDRESSES

Ever wanted to make your
m/c support more than one
IP addresses?

Well, here is the good
old way:

1. To make a machine support
a new (virtual) IP address:

$ ifconfig hme0:1 132.186.67.157 255.255.254.0 132.186.67.255 up

Where:
- First param is hme0 is
the physical name of the
primary interface for your
m/c, (it can be e.g. le0
for other flavours).
':1' is the logical name.
To make it simple, logical
name is kinda branch of the
original. So basically what
your doing with this command
is making hme0 to support one
more IP address on a new
branch named 'hme0:1'.

- Second param is 'new the IP
address'.

- Third and Fourth are netmask
and broadcast address
respectively. Contact your
SysAdm or RTFM. :).

Note: bringing up a virtual IP
address on a node can be
divided in two steps:
1> Create
2> Bring up.
In this case both are done by
this one command.

- Fifth one you know,
don't you?

2. To bring this virtual IP
address down (without
deleting it):

$ ifconfig hme0:1 down

3. To bring this virtual IP
address up agn(hme0:1 has to
exist for this):

$ ifconfig hme0:1 up

4. To delete this virtual
IP address:

$ ifconfig hme0:1 0 down

Note: Assigning 0 as IP
address, deletes it.

IMPORTANT: All of these commands
requires root permission. If
user with lower authority try
to do this, the result may not
be good.

(manuals say problems arising
from that can be tough to
diagnose)

Wondering about where to
use it: We're using this in a
cluster environment to give
client only one IP address
which we make sure is always
up n running on one of the
nodes.


This tip generously supported by: bhatt.kashyap@blr.spcnl.co.in


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Sabtu, 11 September 2010

Unix Tip: LINE # OF A PATTERN

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3502 - September 11, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


LINE # OF A PATTERN

If you are finding a
particular pattern in
a file and want to know
in which line no. it is
present then give this
command.

grep -n "pattern" <filename> | cut -d":" -f1

e.g. Finding hello in
hello.world file

grep -n "hello" hello.world | cut -d":" -f1


This tip generously supported by: baivab.mitra@citicorp.com


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Jumat, 10 September 2010

Unix Tip: SPLIT SCREEN EDITING

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3501 - September 10, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


SPLIT SCREEN EDITING

You can split screen
into multiple windows
in vi.

(Depending on your
version of VI)

TO create the empty
window enter the
command:

:new

TO move between the
screens use the
commands:

To Move to lower window
<ctrl-w>j

Move to upper window
<ctrl-w>k

TO make the current
window the only window
on the screen closing
all other windows,
use:

:only


VIM supports this
feature and can be
found at: http://www.math.fu-berlin.de/~guckes/vim/

This tip generously supported by: mailalokagg@yahoo.co.in

--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Kamis, 09 September 2010

Unix Tip: ACCIDENTS WITH CRONTAB

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3500 - September 9, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


ACCIDENTS WITH CRONTAB

Ever typed the crontab
command and forgot
the -l option?

That's kinda dangerous,
for if you hit ctrl-D
to get back to the
prompt, your crontab's
gone.

To prevent this, make a
script with the following
contents:

#!/bin/ksh
if [[ $# -eq 0 ]] ; then
echo "crontab: no option specified. Aborted."
exit 2
else
/usr/bin/crontab "$@"
fi


Make sure the script is
executable and put it in
a directory that's in your
PATH BEFORE the /usr/bin
directory.

Now if you type crontab
without option or filename,
you'll just get an error
message. If you want to pipe
some stuff to crontab, you
still can do it like this:

% somecommand | crontab -


This tip generously supported by: kees.couprie+ugu@swift.com


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Rabu, 08 September 2010

Unix Tip: ROTATE THE ALPHABET

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3499 - September 8, 2010

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


ROTATE THE ALPHABET

Rot13 simply rotates any
alphabet characters but 13
places, so the letter 'a'
becomes a letter 'n', and
an 'x' becomes a 'k' etc...

To encode a file type:

% rot13 <filename>

And repeat to decode.

(Note original file is
overwritten by encrypted
version.)

Simply create this small
script, and save with the
filename of 'rot13'
remembering to set
appropriate permissions.


#!/usr/local/bin/bash

tr '[a-m][n-z][A-M][N-Z]' '[n-z][a-m][N-Z][A-M]' < $1 1>temp1;

mv temp1 $1;


This tip generously supported by: dan.mcgrath@virginmobile.com


--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Selasa, 07 September 2010

Unix Tip: MORE ON VI LAZY EXISTS

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 3242 - December 22, 2009

http://www.ugu.com/sui/ugu/show?tip.today

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

MORE ON VI LAZY EXISTS

Addendum to VI LAZY EXITS

There is a difference between ZZ and :wq! ZZ will NOT force a write on a
read only file :wq! will.

Also be careful with ZZ if you inadvertently press Control ZZ you will
have stopped jobs.

--------------------------------------------------------------------------
To Subscribe: http://www.ugu.com/sui/ugu/show?tip.subscribe
To Unsubscribe: http://www.ugu.com/sui/ugu/show?tip.unsubscribe
To Submit A Tip: http://www.ugu.com/sui/ugu/show?tip.today

==========================================================================
DISCLAIMER: All UNIX HOT TIPS ARE OWNED BY THE UNIX GURU UNIVERSE AND ARE
NOT TO BE SOLD, PRINTED OR USED WITHOUT THE WRITTEN CONSENT OF THE UNIX
GURU UNIVERSE. ALL TIPS ARE "USE AT YOUR OWN RISK". UGU ADVISES THAT
ALL TIPS BE TESTED IN A NON-PRODUCTION DEVELOPMENT ENVIRONMENT FIRST.

Unix Guru Universe - www.ugu.com - tips@ugu.com - Copyright 1994-2001
==========================================================================

Your Ad Here
Free Automatic Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink Free Auto Backlink