Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

Online coding site: Ancient Brain

coders   JavaScript worlds


CA170      CA2106      CA686      CA686I

Online AI coding exercises

Project ideas


Pipes and redirection

Very powerful features.

Filename completion

Start typing filename, hit special key to complete it.


ps                      See what processes are running
kill (process id)       Terminate some of your processes
kill -KILL (pid)        Definite kill
kill -1                 Kill all my processes

PPID              parent process of this process
xkill &                 Kill the next thing I click on      

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

Display of processes

ps in DCU

  1. Login on PCs with GUI:
    • Old system: Physical login. Then 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.

    • New system: Remote desktop. It seems multiple users can login to same PC.

    • 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. ssh to student.computing.dcu.ie
    • 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

  1. Login on PCs with GUI.
  2. Launch firefox from desktop.
  3. In command-line, type ps
  4. Is firefox in list of processes? If not, why not?
  5. How do you make a list of processes that includes firefox?

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


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.
(Or for a thing you want to do now for which a command-based approach is not appropriate.)

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.

ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.

Note: Links on this site to user-generated content like Wikipedia are highlighted in red as possibly unreliable. My view is that such links are highly useful but flawed.