Complete.Org: Mailing Lists: Archives: presentations: April 2003:
[presentations] Re: This Month's (Monday's!) Meeting Topic
Home

[presentations] Re: This Month's (Monday's!) Meeting Topic

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: presentations@xxxxxxxxx
Subject: [presentations] Re: This Month's (Monday's!) Meeting Topic
From: Tom Hull <thull2@xxxxxxx>
Date: Sun, 13 Apr 2003 00:41:12 -0500
Reply-to: presentations@xxxxxxxxx

Tom Hull wrote:
> Jonathan Hall wrote:
> 
>>Can we secure the meeting room we had for the LDAP presentation? If so,
>>perhaps it would be a good opporitunity to do a "command line"
>>presentation--a hands-on discussion of common shell commands, and basic
>>scripting.
>>
>>I would be happy to present on that topic, altho I can't guarantee that I'd
>>have much of a handout ready.  I think I have a partial one written from
>>years ago, if I can find that, we can use that.  Otherwise, it will just
>>depend on my work schedule on Monday whether I have time to put anything
>>other handout together.  But I can talk off of the top of my head (or out of
>>my ass) even without a handout :)
> 
> 
> I wrote up a rather extensive handout a couple of years ago. Having
> trouble finding a copy here. I think it was on the complete.org aclug
> website. Might be good to start with, either to edit down or ad lib
> off of, if anyone can find a copy. (I'd like to have one myself.)

Still can't find mine, but I found Jeff Schaller's, prepared at the same
time. Enjoy:


 From schaller@xxxxxxxxxxxxx Fri Oct 29 21:54:05 1999

This is in a slightly modified form -- I modified it
and printed it out all in one fell swoop, not saving the
copy that I printed.  This has most of what I covered, except
for the crappy ad hoc part about file permissions at the beginning.

Pipes
        - to pass information from one program to another
        - who | grep schaller

Backticks
        - to insert results from one command into another
        - kill -9 `cat /var/run/named.pid`

Wildcards
        - to pick up more than one file
        - ls *.log
          rm kernel.log.?

Job control
        - manipulate jobs
        - sleep 60 &
          fg %1
          ^Z
          bg

Basics: command vs arguments
        - command is the first word, arguments are the rest
        - command can be a shell built-in, alias, or actual program
          - actual programs are looked for in your $PATH
          - echo $PATH | tr ':' '
            ' | sort -u

Quoting
        - protect arguments from the shell
        - ps aux | grep 'getty console'

Useful commands
        - grep: search for text
                ps aux | grep xterm
                ps aux | grep -v root
                ps aux | grep -c schaller
        - awk: print certain information, others
                ps aux | grep sendmail | awk '{ print $2 }'
                /bin/ls -l | awk '{ SUM += $5 } END {
                  printf "Total Kbytes: %d\n", SUM/1024}'
        - tr: translate characters
                echo ABC | tr '[A-Z]' '[a-z]'
                echo ABC | tr '[:upper:]' '[:lower:]'
        - sed: stream editor
                ps aux | sed 's/schaller/root/g'
        - cut: grab certain parts of line(s)
                /bin/ls -l | cut -c1-1
                echo $PATH | cut -d: -f2
        - rm: remove (unlink) files
            (ls -l file[s]) and look at the number between permission bits
            and owner -- this is the number of links to the file, typically 1.
                rm /var/www/index.html
        - mv: move files
                mv /var/log/kernel.log /tmp/kernel.log
        - echo: prints its arguments
                echo /bin/ls
                echo /bin/l*
                echo $PATH
        - ln: make links (soft or hard)
                ln -s /usr/tmp /tmp
                ln resume.html index.html
            ( ls -i resume.html index.html )

Shell scripts
        - files containing commands to be run
          #!/bin/sh
          ls

                chmod u+x file.sh


-- 
/*
  *  Tom Hull * thull2 at cox.net * http://www.tomhull.com/
  */



[Prev in Thread] Current Thread [Next in Thread]