Re: [SLUG] Weekly celebration of a Unix utility

2004-01-10 Thread mlh
On Sat, Jan 10, 2004 at 04:47:18AM +1100, Michael Kraus wrote:
 G'day...
 
  I am using now quite often the -v option to grep since I learnt of that
  one. It removes a pattern from the imput to grep. Quite useful.
 
 Especially when checking for the existence of a process running...
 
 For example:
 
 # ps -xwa | grep process-name | grep -v grep

I like this bit of cleverness:

# ps -xwa | grep [p]rocess-name 


This pattern will match what you're after
but won't match itself.  So, no need to grep -v grep!

BTW, linux has the pgrep command now.  Much nicer to 
use that grep'ing ps output.


--
Matt
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-09 Thread Michael Kraus
G'day...

 I am using now quite often the -v option to grep since I learnt of that
 one. It removes a pattern from the imput to grep. Quite useful.

Especially when checking for the existence of a process running...

For example:

# ps -xwa | grep process-name | grep -v grep

This will remove the grep process itself from the resultant output...

Ie.

# ps -xwa | grep process-name

will give the output:

5123   process-name
7843   grep process-name

Whilst the former command will only output the first line..

And lets not forget the gnu tools of cut, paste, split and sort are
fantastic - very great for text manipulation and hunting through logs.

All the best...

Mike

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-09 Thread Peter Hardy
Hey hey.

Michael Kraus wrote:
Especially when checking for the existence of a process running...

For example:

# ps -xwa | grep process-name | grep -v grep

This will remove the grep process itself from the resultant output...
You can save yourself a lot of typing by doing this as:

$ ps -xwa | grep [p]rocess-name

The shell will convert [p]rocess-name to process-name when it feeds 
it to grep (I don't remember what the square brackets actually mean to 
the shell). But grep will still see [p]rocess-name in the ps output. 
And of course those two strings are completely different. :-)

And lets not forget the gnu tools of cut, paste, split and sort are
fantastic - very great for text manipulation and hunting through logs.
I have occasional holy wars at work about cut,past,split vs. awk,sed. 
Pointing out things like the sed implementation of sokoban[1] is usually 
a good way to win, though.
:-)

--
Pete
[1] http://sed.sourceforge.net/local/games/sokoban.sed
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Weekly celebration of a Unix utility

2004-01-08 Thread Mike MacCana
* dnstrace. As useful as ping, nc, and traceroute for troubleshooting,
and one of the only tools I've ever seen to show how DNS works in a
simple manner.

* seq. prints out sequences of numbers. First taught to me with the
following magic:

for y in $(seq 1970 2003)
do
for m in $(seq 1 12)
wget http://blahblahblahplaymate${y}-${m}.png
done
done 

Mike
-- 
Mike MacCana [EMAIL PROTECTED]

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-08 Thread Robert Collins
On Thu, 2004-01-08 at 16:21, Michael Chesterton wrote:
 DE LUCA Ben [EMAIL PROTECTED] writes:
 
 
  There was some talk of screen earlier this week and I wondered if we might
  like to talk about some of the cool functions or even bad ones for the rest
  of the week!
 
 screen can be used as a login shell.
 But scp didn't like it, bummer, I'm testing out putting screen -xRR
 at the end of .bash_profile, I haven't noticed any problems yet.

if scp doesn't like it, it'll be because you didn't make it non-tty
clean. to test that - make screen your login shell again, and run ssh -T
echo foo

If you see /anything/ other than echo foo, scp will not work.

Rob
-- 
GPG key available at: http://www.robertcollins.net/keys.txt.


signature.asc
Description: This is a digitally signed message part
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-08 Thread Michael Chesterton
Robert Collins [EMAIL PROTECTED] writes:

 screen can be used as a login shell.
 But scp didn't like it, bummer, I'm testing out putting screen -xRR
 at the end of .bash_profile, I haven't noticed any problems yet.

 if scp doesn't like it, it'll be because you didn't make it non-tty
 clean. to test that - make screen your login shell again, and run ssh -T
 echo foo

 If you see /anything/ other than echo foo, scp will not work.

Thanks.

I don't know what non-tty clean means exactly, but I think I get your
drift. I did a little googling, first hit said the reason it doesn't
work is a feature[1]. They recommended testing if it's an interactive
shell, and execing screen. Which is basically what I'm doing.

As long as I don't have to type screen every time I login, I'm
happy. :)

1. I use that all the time.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-08 Thread Michael Lake
Stuart Cooper wrote:
I was wondering if people would like to talk about
some of the things that
you might be able to do with some simple utilities
that are included with
most Linux distros.
 
Quite often the Linux versions of Unix standard 
programs come from the GNU project and are completely 
packed with new and useful features. Two of my 
favourites:

1) -h option (human readable) in df and du commands
2) less pager F option to go into tail -f mode of
   a logfile you are looking at; which can then be
   changed back to regular less with an interrupt key
I am using now quite often the -v option to grep since I learnt of that 
one. It removes a pattern from the imput to grep. Quite useful.

--
Mike Lake
Caver, Linux enthusiast and interested in anything technical.
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-08 Thread DE LUCA Ben
Hello boys and girls

What I was really hoping for with my initial mail is that each week we might
focus on a different utility.

There are so many GNU utilities that I though we might sacrifice a whole
week to each one. I know that I have been surprised with what can be done
with some utilities More that I thought was possible more than I could
imagine. I thought this might be a good opportunity for the newbies (IE any
one with less than 20 years of unix experience :) ooh that¹s me) to Learn
some great tricks with things that the xPerts know already!



Are you guys in?
:P

Argh flyday afternoon!
Next week lets no talk about screen lets talk about some thing else? How do
you guys feal about showing off your `find` skills from Monday?


--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


[SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread DE LUCA Ben
I was wondering if people would like to talk about some of the things that
you might be able to do with some simple utilities that are included with
most Linux distros.

I spent a few days over the holidays learning more about screen and I can
say it was truly worth it. I was wondering if a few people might like to
join me in discussing some of the cool things about a particular utility
each week? 

There was some talk of screen earlier this week and I wondered if we might
like to talk about some of the cool functions or even bad ones for the rest
of the week!


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread Kevin Waterson
This one time, at band camp, DE LUCA Ben [EMAIL PROTECTED] wrote:

 There was some talk of screen earlier this week and I wondered if we might
 like to talk about some of the cool functions or even bad ones for the rest
 of the week!

Sure, lets begin with VI :)

Kevin


-- 
 __  
(_ \ 
 _) )            
|  /  / _  ) / _  | / ___) / _  )
| |  ( (/ / ( ( | |( (___ ( (/ / 
|_|   \) \_||_| \) \)
Kevin Waterson
Port Macquarie, Australia
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread Stuart Cooper
 I was wondering if people would like to talk about
 some of the things that
 you might be able to do with some simple utilities
 that are included with
 most Linux distros.
 
Quite often the Linux versions of Unix standard 
programs come from the GNU project and are completely 
packed with new and useful features. Two of my 
favourites:

1) -h option (human readable) in df and du commands
2) less pager F option to go into tail -f mode of
   a logfile you are looking at; which can then be
   changed back to regular less with an interrupt key

Since so many Linux programs are so configurable and
options-packed it's well worth the trouble of
reading all about your favourites.

Stuart.

http://personals.yahoo.com.au - Yahoo! Personals
New people, new possibilities. FREE for a limited time.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread DE LUCA Ben
I tried to reply directly but apparently my company is filled with SPAMERS!

Um, I was thinking we might start with screen! its much more use than vi !


 From: Kevin Waterson [EMAIL PROTECTED]
 Organization: Oceania
 Date: Thu, 8 Jan 2004 15:22:36 +1100
 To: [EMAIL PROTECTED]
 Subject: Re: [SLUG] Weekly celebration of a Unix utility
 
 This one time, at band camp, DE LUCA Ben [EMAIL PROTECTED] wrote:
 
 There was some talk of screen earlier this week and I wondered if we might
 like to talk about some of the cool functions or even bad ones for the rest
 of the week!
 
 Sure, lets begin with VI :)
 
 Kevin
 
 
 -- 
 __   
 (_ \ 
 _) )           
 |  /  / _  ) / _  | / ___) / _  )
 | |  ( (/ / ( ( | |( (___ ( (/ /
 |_|   \) \_||_| \) \)
 Kevin Waterson
 Port Macquarie, Australia
 -- 
 SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
 Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
 

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread DE LUCA Ben
I was going to talk about screen this week.

One of the most useful things I think it can do is split a console up into
two viewable/able editable areas  you can do this with the ctrl-S option!

Its great for watching a log whilst you do other things on the computer.

 From: Stuart Cooper [EMAIL PROTECTED]
 Date: Thu, 8 Jan 2004 15:47:52 +1100 (EST)
 To: DE LUCA Ben [EMAIL PROTECTED], [EMAIL PROTECTED]
 Subject: Re: [SLUG] Weekly celebration of a Unix utility
 
 I was wondering if people would like to talk about
 some of the things that
 you might be able to do with some simple utilities
 that are included with
 most Linux distros.
 
 Quite often the Linux versions of Unix standard
 programs come from the GNU project and are completely
 packed with new and useful features. Two of my
 favourites:
 
 1) -h option (human readable) in df and du commands
 2) less pager F option to go into tail -f mode of
  a logfile you are looking at; which can then be
  changed back to regular less with an interrupt key
 
 Since so many Linux programs are so configurable and
 options-packed it's well worth the trouble of
 reading all about your favourites.
 
 Stuart.
 
 http://personals.yahoo.com.au - Yahoo! Personals
 New people, new possibilities. FREE for a limited time.
 

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread Peter Hardy
On Thu, 2004-01-08 at 16:15, DE LUCA Ben wrote:
 I was going to talk about screen this week.
 
 One of the most useful things I think it can do is split a console up into
 two viewable/able editable areas  you can do this with the ctrl-S option!
 
 Its great for watching a log whilst you do other things on the computer.

Just to continue my current obsession with obscure commands, did you
know you can also do this with splitvt? :-)

-- 
Pete

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread Jeff Waugh
quote who=DE LUCA Ben

 I tried to reply directly but apparently my company is filled with
 SPAMERS!

(Yes, I've seen this - Kevin's mail server does seem to reject a lot of
mail.)

- Jeff

-- 
linux.conf.au 2004: Adelaide, Australia http://lca2004.linux.org.au/
 
   'unf' is walking into a door.
 'untz' is walking into a drum kit.
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread Michael Chesterton
DE LUCA Ben [EMAIL PROTECTED] writes:


 There was some talk of screen earlier this week and I wondered if we might
 like to talk about some of the cool functions or even bad ones for the rest
 of the week!

screen can be used as a login shell.
But scp didn't like it, bummer, I'm testing out putting screen -xRR
at the end of .bash_profile, I haven't noticed any problems yet.

-xRR is my favourite way of starting screen, 

-x   Attach to a not detached screen session. (Multi display mode).

-x is handy with working with someone remotely who is learning the
 ropes, the screen is mirrored, they see what you see and type, you
 see what they see and type.


-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html


Re: [SLUG] Weekly celebration of a Unix utility

2004-01-07 Thread Anthony Wood
On Thu, Jan 08, 2004 at 03:22:04PM +1100, DE LUCA Ben wrote:
 I was wondering if people would like to talk about some of the things that
 you might be able to do with some simple utilities that are included with
 most Linux distros.
 
 I spent a few days over the holidays learning more about screen and I can
 say it was truly worth it. I was wondering if a few people might like to
 join me in discussing some of the cool things about a particular utility
 each week? 
 
 There was some talk of screen earlier this week and I wondered if we might
 like to talk about some of the cool functions or even bad ones for the rest
 of the week!

Screen is very worthy, but pipe is da bomb! (Pipe-Bomb?)

cat Zechariah\ Vulgate.txt | perl -lane'print lynx -source 
http://www.perseus.tufts.edu/cgi-bin/morphindex?lang=la\\embed=2\\lookup=$F[$_] | 
grep \\G\\ | perl -pe \s\/\\.*?\\\/;\/g; print qq[$F[0].$_;$F[$_];];\ foreach 
1..$#F' | sh | cut '-d;' -f1,2,8,13 | perl -nle'my ($vw,$mw,$dw,$dd) = split(/\;/); 
$dd =~ s/^Entry in $//;$dd =  \$dd\;print qq[$vw $mw : $dw$dd]'

This little beauty took the Latin words from the Vulgate version of the book of 
Zechariah (Old Testament), plugged them into a webpage which gave the alternate 
meanings, ripped out the meanings and re-formatted them into one Latin word and 
alternate meaning per line, so my friend (PHD at Sydney Uni) could remove the wrong 
meanings and have a word for word translation.

Pipe lets you build up programs on the command line, tie together simple tools 
(grep/cut/sed/awk/lynx/wget/sh/perl/convert) and see how you are going.  I 
particularly like getting perl to print out commands which I pipe to sh.

If you want to get started, try:

a one-liner which sets todays dilbert comic as your background image in x.
splitting a logfile into daily or hourly logfiles using grep, bc, head, tail

cheers,
Woody

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html