Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

Online coding site: Ancient Brain

coders   JavaScript worlds


CA170      CA318      CA686      CA686I

Online AI coding exercises

Project ideas

Introduction to UNIX / Linux

The Command-line

Text-based interface.
Type commands with arguments at a "prompt":

$ command (arg1) (arg2) ...
You can use this as an adjunct to (rather than replacement of) the GUI interface.

The "prompt" may be anything, not necessarily "$". It doesn't matter what the prompt is.

Note: In notes I often use the convention "$" to indicate the prompt, no matter what the prompt is.
Note: In my account seen on screen, I have changed my prompt so it may be different to yours.

Can launch GUI programs:

$ gedit file &


Most commands are not in-built, but are programs, found somewhere in the "PATH" variable:
echo $PATH
This makes the command-line "shell" a reasonably simple program:
See if there exists in the directories listed in the variable $PATH an executable file with the same name as the 1st "argument". If so, execute this file, passing it the other arguments. Else print error message.

Note: The complete list of executable files in the path is normally read once and cached in memory for fast access every time a command is typed.

Hierarchical Directory (Folder) structure

pwd                     Print working directory 
                        e.g. /users/staff/jsmith

cd                      Change directory
ls                      List files

cd ..                   Go to parent directory 
                        e.g /users/staff 

.                       Current directory
/                       root directory
$HOME                   home directory
$HOME/public_html       public web space
/tmp                    system temporary files

Hierarchical file system - /directory/sub-directory/file
Forward slash (this is why Web is forward slash).

ancientbrain.com      w2mind.org      humphrysfamilytree.com

On the Internet since 1987.      New 200 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.