IT 1100 : Introduction to Operating Systems
The Shell Prompt
The prompt on each Linux machine may look different. But on scratch it will use this format:
When I am connected to scratch it will look like this:
@ symbol is just what it looks like - an
: is just a separator. It acts like a space without being a space. We will use colons as separators throughout the semester.
~ (tilda) means that you are currently in your own home directory. If you are in a different directory it will display that for you here. Aka - the
Current Working Directory.
Standard Users have limited permissions it is best to be logged in as a standard user as often as possible. The dollar sign
$ at the end of the prompt signifies that we are in Standard User mode.
Super Users have all permissions at all times, ie Administrative privileges. If there is a hash
# at the end of the prompt it signifies that we are in Super User or Root mode. Avoid Super User mode if at all possible.
Remember - Super Users have all power, all the time, to do all damage.
The home directory
In Linux there are two different meanings to the words
home directory. It is essential to know the difference.
- The first is the main directory called home. This is where every user’s personal files are stored. It’s path looks like this:
- The second is the place where each user stores his personal files. It’s path looks something like this:
The user home directory is denoted in several ways. All of the following mean the same thing.
- ~ (tilda)
- my home directory
- my $HOME directory
$HOME is where you want to be.
File and Directory Paths
When we declare a path to a file or directory we do so using forward slashes. Everytime we want to enter a new directory we add another slash.
If we were to look at my home directory
/home/s/smorgan/, using the GUI and a mouse -
- First click on the
- Inside of this directory would be every letter of the alphabet.
- Second click on the
- Inside of this would be every username that begins with
- Third click on the
- Inside of this would be all of my personal directories and files.
- You have now navigated the path
Pretend that I have a directory inside of my $HOME directory called fruit. To access this the first thing we need to do is declare the path to my $HOME directory.
Fruit is also a directory so I simply add it to the end.
If I want to access a file in the fruit directory called
salad.txt I simply add that to the end.
When accessing directories the final slash is optional. Files will never end in a slash.
Absolute vs Relative Path
This is a very important concept. Knowing the path to get from where you are to where you want to be gives you tremendous power.
We will be studying this all semester long.
Absolute Path is the path from the root ( / ) of the directory system to where you want to go.
Absolute path always begins with a slash.
Relative Path is the path from where you are to where you want to go.
Relative path always begins without a slash.
- mydirectory or mydirectory/
Linux also has special notations it uses that make it easier for us to declare relative paths.
- The use of a . (dot or period) denotes start at our current directory.
- The use of two .. (dots) denotes start at our parent directory or up one level.
- Using the dots is always a relative path.
More Examples - Are these Absolute or Relative Paths? Remember the final slash is optional for directories and files will never end in a slash.
- /home/smorgan or /home/smorgan/
- smorgan or smorgan/
- . or ./
- .. or ../
- mydirectory or mydirectory/
- ./smorgan/mydirectory or ./smorgan/mydirectory/
- ../smorgan/mydirectory or ../smorgan/mydirectory/
Open a terminal connection to scratch and then Read and Complete the Excercises in the Book
Last Updated 12/15/2017