Complete.Org: Mailing Lists: Archives: discussion: October 1999:
[aclug-L] command line presentation notes
Home

[aclug-L] command line presentation notes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Dale W Hodge <dwh@xxxxxxxx>
Cc: aclug-L@xxxxxxxxxxxx
Subject: [aclug-L] command line presentation notes
From: Jeff <schaller@xxxxxxxxxxxxx>
Date: Fri, 29 Oct 1999 16:21:24 -0500 (CDT)
Reply-to: aclug-L@xxxxxxxxxxxx

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


[Prev in Thread] Current Thread [Next in Thread]
  • [aclug-L] command line presentation notes, Jeff <=