Your Ad Here

Rabu, 31 Agustus 2005

Unix Tip: VI COPING BETWEEN FILES

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2434 - August 31, 2005

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

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


VI COPING BETWEEN FILES

VI editor is a very powerful editor. Suppose you want to copy line numbers 1-10 and 23-77 of file A and paste them on file B at the same time, what will you do ?? Here I am giving a tip to do this :-

Place the cursor on line no. 1
Press ESCAPE
Press Shift "(Shift double quotes)
Press a
Press 10yy [the number of lines you want to copy]

Now place the cursor on line no. 23
Press ESCAPE
Press Shift "(Shift double quotes)
Press b
Press 55yy [the number of lines you want to copy]

Now the first 10 lines have been copied in buffer "a" and next 55 lines have been copied in buffer "b".

Now press " : " (COLON) to get the vi prompt. Hit e "Destination file name"

Once you enter the Destination file go to the line where you want the first 10 lines in buffer "a" to be inserted.

Press ESCAPE.
Press Shift "(Shift double quotes)
Press a.
Press p.

The first 10 lines in buffer "a"
gets inserted.

Now go to the line where you want the rest 55 lines in buffer "b" to be inserted.

Press ESCAPE.
Press Shift "(Shift double quotes)
Press b.
Press p.

The rest 55 lines in buffer "b" gets inserted.


This tip generously supported by: ardhendu99@yahoo.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, 30 Agustus 2005

Unix Tip: KILL REALLY DOES NOT KILL

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2433 - August 30, 2005

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

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


KILL REALLY DOES NOT KILL

kill is not really meant only to kill a process. But main intention is to send a signal to process.And the process handles these signals to do various tasks.


kill -INT 1234
#where 1234 is the Process ID is really, this set an interrupt signal, Ctrl-C is an example of interupt signal given to shell.


kill -HUP 1234
#some UNIX daemons handle this, to do refreshing business.


kill -KILL 1234
This is the sure kill,which cannot be handled by any process. Also know as, kill -9 1234.

Just, check the in the file /usr/include/sys/signal.h for all signals on the system.

More about this can be found on kill and signal man pages.

This tip generously supported by: dkotian1@rediffmail.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
==========================================================================

Senin, 29 Agustus 2005

Unix Tip: XVI A FILE

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2432 - August 29, 2005

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

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


XVI A FILE

To open a file in a new xterm session, just say:

% xvi file.c

When the following alias is set:

alias xvi 'xterm -fn Courier7 -geom 132x56 -sb -sl 2048 -bg
wheat -fg black -cr red -T "!*" -e vi !* &'


This tip generously supported by: wizkdbec@mailcity.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, 28 Agustus 2005

Unix Tip: CAT A BINARY FILE, OOPS!

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2431 - August 28, 2005

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

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


CAT A BINARY FILE, OOPS!

If you have accidentally output binay info to your terminal

For ex.

# cat BinFile

You dont have to kill the terminal and start a new one.

Just type at the prompt:

# tput reset

Works for me on Linux.

This tip generously supported by: sarada@ece.iisc.ernet.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, 27 Agustus 2005

Unix Tip: WHERE WAS IT STARTED?

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2430 - August 27, 2005

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

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


WHERE WAS IT STARTED?


When you want to find out where a process as ben started on SUN server, use:

/usr/proc/bin/pwdx [pid].

It will give you the path of the executable.


This tip generously supported by: erik.vincent.teleglobe.ca

--------------------------------------------------------------------------
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, 26 Agustus 2005

Unix Tip: TRIMMING THE LOG

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2429 - August 26, 2005

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

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


TRIMMING THE LOG

Various unix processes can produce fast growing logs that sometimes need to be trimmed instead of deleted, for reference or troubleshooting. And you likely have no desire to edit the files. Here is a handy ksh script that will quickly trim the log so it keeps recent information and lets you keep as many lines as you think you might need. I call it trimlog:

#! /bin/sh
# trimlog
filesize=`cat $1|wc -l`
trim=`expr $filesize - $2`
if [ $trim -gt 0 ]
then
sed "1,$trim d" $1 > /tmp/$1
mv /tmp/$1 $1
echo $1 trimmed by $trim lines
fi

Use it by feeding in the name of the log you want to trim followed by the number of lines you want to keep:

# trimlog oracle_listener.log 10000


Of course you can't use it in the /tmp directory. There are probably newer and more efficient ways to do this, but this works.


--------------------------------------------------------------------------
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, 25 Agustus 2005

Unix Tip: FOLDING IN LINUX

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

UNIX GURU UNIVERSE
UNIX HOT TIP

Unix Tip 2428 - August 25, 2005

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

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


FOLDING IN LINUX

Fold Long Line files to Finite Width output device files.

Ex: fold -b < long_line_file >folded_file

Now the folded_file will contain output with newlines inserted after maximum bytes specified. This will be useful when editing special files. You can do the reverse using "expand" command.


This tip generously supported by: srinu.sasubilli@wipro.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
==========================================================================

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