Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
> Help with linux commands
post Feb 17 2012, 02:00 PM
Post #1

Whats this Lie-nix Thing?

Group: Members
Posts: 5
Joined: 17-February 12
Member No.: 17,443

so I am taking an introductory course to linux, and I'm having trouble with one of my labs. I cant find the attach file button so I'll just paste the instructions here.
ULI101 Lab 03 - Unix Pathnames / Directory Structure

Pathnames in Unix/Linux are divided into two types . The first is the absolute pathname, which always starts with the / (forward slash), commonly named the root. The second type of pathname is the relative pathname, which is aptly named, for it is relative to your current working directory location. It is important for the user to be able to create and manipulate the file structure by using both absolute and relative pathnames.
Most beginners have more difficulty understanding and becoming proficient with relative pathnames than absolute.
Keep that in mind and practice relative pathnames as much as possible.

Let's take a look at a sample of an absolute pathname to create a directory off of your home directory named seneca.
Since we are using an absolute pathname to create the seneca directory, we know that the pathname must start with the /, or root. Hence, the command line:

username@matrix:~> mkdir /home/username/seneca (where "username" is your Matrix login ID).

If you want to make the same directory in your home directory using a relative pathname you would not start with the slash, or root, but would simply name the file, assuming that your current working directory is already your home directory. Hence, the command line:

username@matrix:~> mkdir seneca
Practical Application

Create the directory tree structure shown below using relative pathnames in your matrix account's home directory. Use the touch command to create empty files matching the filenames displayed within the directories. You can detect a directory if the name appears in blue - all regular files appear in green or black.
If the Labs directory still exists from your previous work, you do not need to create that directory.

Verify that your directory structure is correct by using the tree command.
Examine the tree diagram that is shown and verify you have correctly created the above structure before continuing this lab.
File System Navigation

To move around in a directory tree you use the cd command with absolute or relative pathnames. Using the directory tree structure shown above, let's take a look at how to navigate the entire tree. (You will need to replace username with your own login name).
Issuing the cd command without a pathname argument will always take you back to your home directory, regardless of your current location

To move to the seneca directory using an absolute pathname:

cd /home/username/Labs/lab4a/seneca

To do the same operation using a relative path:

cd Labs/lab4a/seneca
The above relative path assumes that your present working directory is your home (/home/your_username/)directory.

If you wish to go up within a directory structure using a relative path you will need to use a special relative pathname - .. (double period), which represents the parent directory. Consequently, the ../.. path represents the parent of the parent directory and so on.
All directories on a Unix/Linux file system have a parent directory except the root directory

For example, if your current location is library, to move to the newnham directory you would use the following relative pathname command:

$ cd ..

(If you examine the library directory you will notice that newnham is the parent of library.)

As another example, if your current location is security, to move to the cns directory you would use the following relative pathname command
$ cd ../../s@y/cns

(The first set of ..'s moves you to the newnham directory, the second set of ..'s moves you to the root. Then you simply declare the path down to your location.)

Some beginners incorrectly assume that all relative pathnames start with the .. path.
Although such approach may work some of the time, it shows a lack of understanding of relative pathnames and leads to inefficient work habits.

Consider this: if your present working directory were newnham, and you would like to change it to security using a relative pathname, the correct answer would be: cd security
A successful, but inefficient alternative could be: cd ../newnham/security

Before continuing with this lab make sure you execute the following command successfully:


The above script will verify that your directory structure has been created correctly and offer suggestions in case of problems.
Make sure to correct all reported errors before proceeding.
Go to the top of the page
+Quote Post
Start new topic
post Feb 17 2012, 04:29 PM
Post #2

Whats this Lie-nix Thing?

Group: Members
Posts: 5
Joined: 17-February 12
Member No.: 17,443

sorry, I wasn't asking for you to do my homework tongue.gif I just posted everything just incase. I hadn't realized there's a space between cd and ..
Go to the top of the page
+Quote Post

Posts in this topic

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 18th July 2018 - 03:10 PM