Chapter 4 Answers to Exercises in Section 4.6

4.6.1. General

  1. top
  2. ps
  3. man ps
    ps aux or ps -e
    
  4. The load on cpu goes very high. To stop, use Ctrl-C.
  5. xclock
    Ctrl-Z (stops the xclock. Ctrl-C would kill it)
    bg
    ps |grep xclock
    kill <pid for xclock> 
    (or kill -15 <pid for xclock> for SIGTERM, 
    or kill -9 <pid for xclock> for SIGKILL)
       
  6.  xcalc & 
  7. From “EXAMPLES” in man kill : “Kill all processes you can kill”
  8. $ who
    ajlewis2 pts/0        2006-11-25 21:54 (:0.0)
    ajlewis2 pts/1        2006-11-26 14:38 (:0.0)
    $ write ajlewis2 pts/1
    hello there!
    what's happening?
    
    • After typing the write command, there may be a beep and there will be a new line. Type message. After you are finished, do Ctrl-C.
    • The write command is not enabled in all distributions.
    • In that case, for an alternative to this command, try:
    • $ who
      ajlewis2 pts/0        2006-11-25 21:54 (:0.0)
      ajlewis2 pts/1        2006-11-25 21:54 (:0.0)
      $ echo "Hello user, let's have lunch together?" > /dev/pts1
      
  9. displays bootup messages from the kernel and modules. System administration command.
  10. practically instantaneous (.005 seconds) since there are few files in the directory
    • time ls
      real    0m0.005s
      
  11. ps aux | grep "ajlewis2" 
    (replace ajlewis2 with the appropriate user name)
    
    • There are a lot of options to read about in man ps. To find a UID, there is a command called getuid. However, it is not recognized in Debian Etch.
  12.  uptime 
  13.  tty, or who 
  14. [Removed question from exercises]
  15. mount, umount, su. Commands that affect the system, but may need to be run by authorized users
  16. Look for processes at the top of:
    • top

4.6.2. Booting, init, etc.

  1. ?
  2. ?
  3. telinit 5
    telinit 3
    
  4. ?
  5. uname -r
    
  6. One of the following or similar:
    • Move deliver_pizza to /etc/rc4.d or wherever your run level 4 script links are located
    • Move deliver_pizza to /etc/init.d and link to it from /etc/rc4.d
    • Simply link to the current location of deliver_pizza from /etc/rc4.d
    • Create a new script that runs deliver_pizza and put it in /etc/init.d with a link to it in /etc/rc4.d

4.6.3. Scheduling

  1. (sleep 600; echo Pasta\'s ready) &
  2. at 20:58
    at> cp -a ~/* /var/tmp/anita-home/
        
    • Then do Ctrl-D which produces
      at> <EOT>
          
  3. crontab -e and add:
    00 12 * * 1-5   cp -a ~/* /var/tmp/anita-home/
        
  4. Check for results after the time has passed
  5. Should get an email reporting error. I don't have internal mail set up.

Home

/home/www/LinuxBasics.org/data/pages/course/book/anskey_04.txt · Last modified: 2008/07/20 21:08 (external edit)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0