_thescratchpost.com  
 
__SITE SHORTCUTS
__PREVIOUS FEATURES

_
ARTICLES AUG 06
_
ARTICLES SEPT 00 - JUNE 06
_ FEATURED ARTISTS

__
REVIEWS
_ MOVIES
_
GAMES

__RESOURCES
_ COMPANY LISTINGS
_
SCHOOL LISTINGS
_
GETTING THE JOB
_
INTERNSHIPS
_
INDUSTRY DEFINITIONS

__INFO
_ FAQ
_
ABOUT US
_
CONTACT US
_ CONTRIBUTORS
_ ADVERTISE WITH US
_ LINK 2 US

Search Amazon Now:
 
In Association with Amazon.com

Home > Resources > BASIC UNIX FOR BEGINNERS

written by: Dani Rosen © 2000

choose a topic from the pulldown, or read them in order...

The Unix Environment
PC machines using DOS or Windows as the operating system, will have a specific letter representing each drive on the system (Hard drive, CD-Rom, Zip drive, etc.) as well as different partitions. Often "C:\" represents the first partition of the first hard drive. The Unix environment, on the other hand, uses one tree structure with many branches (sub-folders / sub-directories), and even though a Unix machine might have more than one hard disk, a CD-Rom, or other peripheral, each one of these hardware devices is put under the same tree structure rather than receive a new Drive Letter. The top of the tree structure is called "Root" and is represented by a forward slash - "/" (unlike the back-slash on PCs - "\"). Underneath the Root you would normally find these typical directories (only a few are shown):

/
|
|----- etc
|
|----- usr
| ___|----- sbin
|
|----- bin
|
|----- home
____|----- myname
________|----- mail

The tree structure is a hierarchy of directories and sub-directories. Moving through this structure can be done using an absolute path or a relative path. An absolute path is one that represents the location starting from the very top, the root. In a shell (a window where we type commands - not a sea-shell) we start of at our home-space and type "pwd" to see our absolute path:

# pwd
/home/myname

The "#" symbol represents the beginning of the line where we can type our commands. It can be set to a different symbol but it's just a representation symbol, it has no affect on your commands. You often see different symbols like ">", ":", "]", "%", "$", etc. For these examples I'll use the "#" symbol.

The "pwd" command shows the Present Working Directory, and in this example it shows you're in the "myname" directory, underneath the "home" directory, which is right under the root. This line, starting from the root, "/", is called an absolute path.
Some systems may configure your command line to include the "pwd" in it:

[/home/myname/]

When you want to move to a different directory using an absolute path, you enter the whole path starting from the root. You use the "cd" command (Change Directory) to move to other directories:

# pwd
/home/myname
# cd /bin
# pwd
/bin

We just moved to the "bin" directory, which is under the root.

An absolute path would always get you exactly where you want to go, no matter where you are. Typing "cd /bin" from anywhere in the tree structure would always get you to the "bin" directory. However, sometimes you just want to take a small step, and don't want to enter the whole absolute path. For those cases you use a relative path. A relative path always works from your current location and will not give you the same results when you're in a different location. For example:

# pwd
/home/myname
# cd mail
# pwd
/home/myname/mail

As you can see, I didn't have to type the whole absolute path starting from the root "cd /home/myname/mail" because it was much quicker for me to do this relatively. However, I won't be able to type "cd mail" from a different directory and expect to get to the same location. Relative navigation uses some useful symbols:

"." - current directory
".." - parent directory
"-" - last directory
"~" - home space

Examples:

# pwd
/home/myname
# cd ..
# pwd
/home
# cd ..
# pwd
/
# cd bin
# pwd
/bin
# cd ~
# pwd
/home/myname
# cd -
# pwd
/bin

What happened here? First we moved up one directory (..) to "/home", then again to "/" (root). We then moved to the bin directory and then to our home space (~). We then moved to the last directory we've used before moving to home-space (-) which was back at "/bin". Note - accessing you home-space can be done by simply typing "cd" with nothing else after it.

Relative navigation can be done in one line too:

# pwd
/home/myname/mail
# cd ../../../
# pwd
/

In one command we moved up a directory three times till we got to root. The ".." symbol is just a representation of the directory above the one we're in. Another example:

# pwd
/home/myname
# cd ../../bin
# pwd
/bin

The "." Symbol represents the current directory. We can use it with the copy command "cp". The "cp" syntax is: "cp source destination", so to copy a file called "myfile.txt" from the "/tmp" directory to the one I'm currently in, I would type:

# cp /tmp/myfile.txt .

Using an absolute path, I would type:

# cp /tmp/myfile.txt /home/myname/

.
on to Understanding Unix Commands>

 

 
Search TSP Content for:
Join Our Job Mailing List
Want to check out past job postings ? click here
COMPANY LISTINGS

View Visual FX by:
Index Listings
A-Z Listings
A-Z Dictionary

View Interactive Gaming by:
Index Listings
A-Z Listings
A-Z Dictionary
View Web Design By:
Index Listings
A-Z Listings
A-Z Dictionary
Interactive TV
iTV A-Z Dictionary
SCHOOL LISTINGS
• View Schools by:
A-Z Listings
Index Listings
EDUCATION 101
 
• THE JOB HUNT
• THE RESUME
• THE DEMO REEL
• THE PORTFOLIO
• THE INTERVIEW
• REFERENCES
• BASIC UNIX
• LAYOFF BLUES

 

FEATURES     EVENTS     REVIEWS     RESOURCES

About us     Join Mailing List     Contact Us     Advertise with Us     Submit Article


THESCRATCHPOST.com, Inc. © Viviana Palacios 1997-2006
ALL TSP character designs are the property of Lance Powellฉ01 and are protected by property laws of USA

**Version 2.0 **