Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

Search:

CA216      CA249      CA318

CA400      CA651      CA668


More UNIX



Pipes and redirection

Very powerful features.




Filename completion

Start typing filename, hit special key to complete it.



Processes



ps                      See what processes are running
kill (process id)       Terminate some of your processes
kill -KILL (pid)        Definite kill
xkill &                 Kill the next thing I click on      

kill -1                 All my processes
killall

PPID              parent process of this process

nice			Run something at low priority deliberately
time			Time a run of some program    




ps in DCU

  1. Normal login in DCU labs:
    • You each have your own CPU and memory, sharing a central filesystem.
    • "ps" will show that the only processes running on the machine are yours and the Operating System's.

    • ps -Tf
      -T        associated with this terminal
      -f        full details
      

    • ps -u $USER -f
      -u $USER  associated with this user
      

    • ps -u $USER -o user,pid,ppid,comm,args
      -o  Show these fields
      


  2. If doing ssh to student.computing.dcu.ie:
    • Possibly shared CPU with other users.
    • student.computing.dcu.ie is a Linux cluster, so some users have their own CPU, others are on shared CPUs, by chance.

    • To see other people's processes:
      ps -Af
      -A  all processes
      


Exercise with ps

To be done in Linux in lab:
  1. Launch firefox from desktop.
  2. In command-line, type ps
  3. Is firefox in list of processes? If not, why not?
  4. How do you make a list of processes that includes firefox?

  5. Launch firefox from command-line.
  6. Use ps to find the path of the firefox program.
  7. Observe that it is in a directory that is not in the PATH!
  8. Explain how it ran, given that it is apparently not in the PATH.
  9. Clue: See the "which" command.


Interrupts

Usage seems to vary on different variants of UNIX and Linux. You may get something like:

Ctrl-S                  Pause
Ctrl-C                  Interrupt
Ctrl-D                  Kill, Logout

Ctrl-Z                  EOF
 
q		exit man, more



Command-line Philosophy

A computer for programmers.


GUI Philosophy

A computer for non-programmers.


Note that user interface people say these dialogs are often ignored.
From Donald Norman, The Psychology of Everyday Things, 1988, Ch.5:

Human - Delete all my most important files.
System - Are you sure?
Human - Yes Yes.
System - Are you really sure?
Human - Yes Yes.
System - All your most important files deleted.
Human - Oh damnit.

Compare with UNIX:

Human - Delete all my most important files.
System - (Silence.)
Human - Oh damnit.



Command-line on Mac / Windows





From xkcd.



Feeds      w2mind.org

On Internet since 1987.