Dr. Mark Humphrys

School of Computing. Dublin City University.

Home      Blog      Teaching      Research      Contact

My big idea: Ancient Brain


CA114      CA170

CA668      CA669      Projects

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.

Wikipedia: Sometimes I link to Wikipedia. I have written something In defence of Wikipedia. It is often a useful starting point but you cannot trust it. Linking to it is like linking to a Google search. A starting point, not a destination. I automatically highlight in red all links to Wikipedia and Google search and other possibly-unreliable user-generated content.