Using a Shell
One of the main philosophies of UNIX, the operating system written in the 1970s that Linux is based on, was to write programs that "do one thing and do it well." Therefore, a lot of the programs you run from a shell do very specific things (unlike many modern programs; Windows Explorer and Mac's Finder both can create, delete, move, copy, and rename files. In a Terminal, there are seperate programs to do each of those things).
The first important commands for you to run (if you haven't already) is one to change your password to something more memorable than the one that was given to you and the one to setup email forwarding.
A Quick Digression on Passwords
When you pick a password for your CS account, make sure it's secure, and not the same as the password for your Brown account. Even though you might think, "I don't really care if someone breaks into my account; it's not like I have anything valuable there," you're missing part of the problem. If your password is easy for someone else to guess, the entire CS department network becomes vulnerable to whatever your have access to: public storage space, email servers, local hardware, printers, etc. Please make sure your account is secure!
Setting your Password
If you do not already have a Terminal window open:
- Double-click the Terminal icon on your desktop or
- Navigate to "Applications" -> "Accessories" -> "Terminal"
When you have a Terminal window open, you will notice that there is some text already in the window. This information tells you about the current shell you're running. For now, the most important part of that text is the $ symbol, which is called the command prompt. When the cursor is at a command prompt, the shell is letting you know that it's ready for your input.
To run the command to change your password, type the following at the prompt, and then hit return to run the command:
passwd
You will be prompted to enter your current password, and then a new one twice. When you enter the password, you will not see *'s for each character. Just keep typing, and Linux is keeping track. If you mess up, you can always try again.
Your new password must:
- Be at least 8 characters long
- Have at least three of the following:
- an Upper case letter
- a Lower case letter
- a Number
- a Symbol
Setting up Email Forwarding
If you have not already setup email forwarding you should do so now. For CS15 it is VITAL that you check you email once per day since we will send you updates via email as they come up. The easiest way to check your CS email is for it to be forwarded to your regular email account.
If you do not already have a Terminal window open:
- Double-click the Terminal icon on your desktop or
- Navigate to "Applications" -> "Accessories" -> "Terminal"
Now that you have a terminal open type the following at the prompt, and then hit return to run the command:
mailconfig -a yourEmailAddress@someDomain.com
Your CS email will now be sent to your other email account. For your reference your CS email address is yourLogin@cs.brown.edu
Shell Commands
A command typed into a shell may have up to three parts, depending on the command and how it's used:
- The command name
- Modifications to the command (called "flags")
- Things to perform the command on or with (called "arguments")
Not all commands require all three parts, but they all must contain a name.
Let's take a look at a sample command: pwd. Like the Windows Explorer and Mac Finder, Linux terminals have the concept of a "Current Location" when browsing the file system. Like the file system on Windows and Mac, files on Linux are organized hierarchically. One difference with Linux is that all files and folders are contained within a "root" folder, no matter what physical disk or drive they're on. This is great for a network setup like we have here in the Sunlab — you don't know (or care) what drive the files are physically stored on, you just want to know how to get them.
This "root" folder (or directory, as they're commonly called in Linux) is just called "/". All subdirectories are also separated by a /, so a directory called "MyAwesomeDirectory" in root would be represented as /MyAwesomeDirectory/.
Likewise, the path "/stuff/things/my_thing" would represent a file called "my_thing," which is contained in the directory "things," which itself is contained in a directory "stuff," which itself is contained within the root directory "/."
Two directories on the department system that you may be working with are:
/home/your_login/(for example,/home/hvjackso): Everyone has a "home" directory within/home/where they can keep files./course/cs015/: This is a directory where a lot of CS15 support files are stored.
The location of the current shell (called the working directory) can be found by using the command pwd, which stands for "print working directory".
At the command prompt, type:
pwd
The results of a pwd command.
By default, new shells will start in your home directory, which is what the results of the command show. (Note that you can also see the working directory to the left of the command prompt. The home directory is often abbreviated with the tilda character ~, which is why you may see that at the prompt instead of the full path name.)