Dr. Mark Humphrys

School of Computing. Dublin City University.

Online coding site: Ancient Brain

Search:

Online AI coding exercises

Project ideas


More UNIX



Pipes and redirection




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
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 lab PCs
    • 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. 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

Chrome from GUI:
  1. Launch Chrome from the Linux GUI.
  2. In command-line, type ps
  3. Chrome is not in the list of processes. Why not?
  4. How do you make a list of processes that includes Chrome?

Chrome from command-line:
  1. Launch Chrome from command-line:
     google-chrome &  
  2. ps now shows Chrome
  3. It actually shows a program called "chrome" running, not "google-chrome".
  4. So what is google-chrome? Type:
     which google-chrome 
  5. Follow the trail of shortcuts to find the actual program.
  6. The program is a shell script. Look inside it to find where "chrome" is and how it is launched.


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.
(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.      New 250 G VPS server.

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.