Skip To Content

Athabasca University

Linux Help

The Linux Operating System can be used in many different ways. However, as a student at Athabasca University there are certain commands that you should get to know. These commands will help you organize your personal directory, and make doing things more efficient.

The following section will walk you through a simple tutorial based on the commands that you will most frequently use as a student. Keep in mind that Linux offers hundreds of different commands not outlined. 

Student Accounts
Student project accounts are available on Athabasca University's student server to upload course projects on the Student Server. Therefore, it is important to learn how to manage your student account, so that you can better utilize it to meet your needs. Most importantly, you have to remember that Linux is CASE SENSITIVE. This means, that you have to type in the commands exactly as they appear. If you receive an error message, please ensure that you have not reverted to upper or lower cases. Finally, your Linux prompt will reflect your home directory. For example, if your login_id to the Unix system was jmontana, your home directory would be:

/home/jmontana/

Your command line prompt might have the following format:

[jmontana@student jmontana]$

OR

-bash-3.2$

Listing the contents of your student account
Great, so you now have your very own Linux account. But what is next? Well for starters, you have to be able to see what is currently on your account. To do that, you will use the ls command. This command will display the contents of your current directory. Generally speaking, most student accounts will have a prompt simlar to this: [jmontana@io jmontana]$ on the student.athabascau.ca server. (For simplicity purposes we will display the student directory system in the examples). This indicates the level of depth for your personal directory. If you wanted to see the contents of student:/home/login_id$ you would type ls. This would produce a list of all the files and directories in the directory login_id. Directories are distinguishable from files because they have a "/" at the end of them. Directories can be thought of as the drawers in a filing cabinet. You utilize directories to organize and sort related information. For example, you might have a project directory whereby, all of your project course work is stored. Not only does this make it very convenient for you to store your information, it also saves you the time and energy searching for specific materials.

The command ls -l, gives you a more indepth listing than just ls on its own. The results displayed indicate the permissions on a particular file or directory. Permissions can be thought of as access rights to a file or directory. For example, you might find the following on your particular account when you execute the 'ls -l' command.

drwx--x--- 2 login_id STUDENT 512 Dec 12 14:33 Mail/

The d indicates that the specified file is a directory. Mail/ is a directory because it is signified with a "/".
The r indicates that the directory is readable by others.
The w indicates that the directory is writable by others.
The x indicates that the directory is executable by others.

The other "-"'s(dashes) indicate the same functions as previously mentioned: read/write/executable. However, they apply to different levels of users. For a more indepth analysis of Unix commands, refer to the man pages.

Just for fun, try typing ls -a. You will notice that there may be a lot more files in your directory than you originally thought. You might see something similar to: .profile. The . indicates that the file is "hidden". So if you w ere to do just a plain ls from the Unix prompt, you would not be able to see the listing of the file.

Creating your own directories:
So you want to create your own directories on your account so that you can organize your files in a more efficient and organized manner? Well, the process is quite simple. Simply type: mkdir directory_name. For example, if you want to create a directory called "Projects", type: mkdir Projects. If you were to type in the ls command, you would now see that a new directory named "Projects" has been created. You can directories to suite your needs by following the above procedure.

Navigating your directories
It is great that you now have created directories in your home directory. But what good are they if you can't navigate amongst them? By navigating, we are referring to the ability of going into the directories at will to see what contents they hold. This is where the cd (change directory) command comes into play. Assuming that you are in your home directory: student:/home/login_id$ type: cd Projects. You will now notice that your Unix prompt has changed to student:/home/login_id/Projects$. Now you could type ls to see the contents of that directory.

To return back to your home directory, you have one of two choices: either type: cd .. or type: cd and press return. The first example will take you back one level, in this case back to student:/home/login_id$, if you were to type: cd.. again, it would take you down one more level, to student:/home$. The second example will return you to your home directory no matter how deeply nested you are in directories (this is always good to know when you are first learning how to navigate through your account).


Copying/Moving files to your newly created directory:
Let us assume that you have the following files (duedates.doc, phil371.mid, and engl255.doc) in your home directory: student:/home/login_id$. "duedates.doc" contains all the due dates for your courses. You definitely don't want to lose this, so you decide to put a copy in the newly created "Projects" directory that you created in 2. above. To do this, simply type: cp filename destination. So in our case, we would type: cp duedates.doc Projects. Now there is a copy of the "due dates.doc" in your Projects directory. Use the ls command to verify this (HINT - type: ls Projects).

Now let us assume that you wanted to move the file phil371.mid to the Projects directory. This will physically move the file from your home directory to the "Projects" directory (only one instance of the copy will be available; and it will now be in the "Projects" directory). To do this, we type: mv filename destination. In our case, we would type: mv phil371.mid Projects. To verify the results, type ls to get the contents of your home directory and then type ls Projects to see whether or not the file has actually been moved to the "Projects" directory.

An important thing to remember:

* If you typed in "projects" instead of "Projects", a file called "projects" would have been created in your home directory.

Removing/Deleting files:
After a period of time, you may come to realize that you may no longer require a particular file. So in such an instance, you decide that you want to delete it (permenantly) from your directory. To do this, you would type: rm filename. To remove the file phil371.mid you would first have to change your directory to reflect where the "deletable" file is kept. So type: cd Projects. Your Unix prompt should now read: student:/home/login_id/Projects$. You can do an ls to verify that the file you want to delete is in fact in this directory. Now to delete the file, you type: rm phil371.mid. You will be prompted to confirm the deletion. If you want to delete the file press "y". If you decided that you don't want to delete the file press "n". Be careful with this command, once you have deleted a file, it is difficult, if not impossible to retrieve.


Removing/Deleting a directory:
You may find that once you have completed a course a directory that you created for it, is no longer required. In this case you would want to remove the directory from your home directory. However, keep in mind that in order to remove a directory, it has to be empty and you can't be in the directory that you are trying to delete. For example, if you were trying to delete "Projects", your Unix prompt could not be in the directory: student:/home/login_id/Projects$. In our particular case, we have just deleted the phil371.mid file, but there is still the duedates.doc file in the Projects directory. Follow the steps above and delete the "duedates.doc" file before continuing. Once the directory is empty, you can verify this by typing: ls, you can remove/delete the directory. Simply type: rmdir directoryname. We would type: rm Projects. The directory has now been deleted.

For a more detailed explanation of Unix commands visit On-Line Linux Man Pages.


Other neat comands

At your Unix prompt, type: who to get a current list of users on the system.

To find out what each user is doing, type: w. This is how profs find out if you are working or not :)

To get detailed information about last login date of user, and the last time they read their mail, type: finger userid. For example, finger kstauff.

Updated October 26 2016 by FST Technical Staff

AU, CANADA'S OPEN UNIVERSITY, is an internationally recognized leader in online and distance learning.