The first order of business is to go over the syllabus. The latest version can always be found here.
Next, we walk through the process of logging into the Silo server.
We're now looking at a command-line interface. This means that the only way to communicate with the server is by typing in characters and the only way it can communicate with us is by sending us text. Your mouse is almost completely useless at this point.*
Enter in your IU username and hit enter. (Not tab!) Then enter in your IU passphrase. You won't see anything appear on the screen, which is a pain in the butt if you have a long and complicated passphrase, but there's not much we can do about that but complain. Backspace works, but you can't see what it's doing, so if I screw up, I usually just hit enter and try again. Hit enter again to log into Silo.
You should now be at a Linux prompt, which looks something like [username@silo ~]$. There's a lot I could say here about using Unix/Linux, but there are plenty of good references for that on the page, so right now, we'll just walk through creating a directory, creating a text file, and changing permissions.
[ewennstr@silo ~]$ ls
apache Documents Music mysqld-error.log Public test
bin Downloads mysql php-5.5.13 README Videos
Desktop httpd-2.2.27 mysql-5.6.19 Pictures Templates
The command ls
lists all the files and folders in the current directory. Let's make a new directory using the mkdir
command and call it "homework".
[ewennstr@silo ~]$ mkdir homework
[ewennstr@silo ~]$ ls
apache Documents httpd-2.2.27 mysql-5.6.19 Pictures Templates
bin Downloads Music mysqld-error.log Public test
Desktop homework mysql php-5.5.13 README Videos
We use ls
and we can see that the new directory is now there. Now let's move inside the new directory with the cd
(change directory) command. This command works pretty much the same as it does in DOS or a Windows command line.
[ewennstr@silo ~]$ cd homework
[ewennstr@silo homework]$ ls
There's nothing in this directory. Let's change that. We'll use the text editor named "Pico" to open a file called "one". Since there is no file named "one" yet, it creates one for us.
[ewennstr@silo homework]$ pico one
We're now in the Pico window. In this file, I want you to put your name, your e-mail address, and a list of programming languages that you have some experience with. You can add any other message if you want. When we're done, we hit Ctrl+X (see the nice guide to commands at the bottom of the Pico screen). When it asks if we want to save, we hit Y
for "yes".
[ewennstr@silo homework]$ ls
one
[ewennstr@silo homework]$ cat one
Erik Wennstrom
EWennstr@ewennstr.edu
Some programming languages I have experience with:
BASIC
Python
C++
R
Scheme
PHP
Inform 7
We check to see that the new file is there with ls
and we can ask to see the contents of a text file with the cat
command. So we're done with the assignment, right?
Well, not quite. See, if anyone else (in particular, your instructor and your graders) tries to access the file, they won't be allowed to because as it is, the only account that's allowed to read the file is the one we're currently logged into. We can view permissions (and other things) using the ls
command by adding the -l
option.
[ewennstr@silo homework]$ ls -l
total 4
-rw------- 1 ewennstr faculty 128 Jun 20 12:19 one
That -rw------- at the beginning is a key that tells us what the permissions are. Ignore the first character for now. Characters 2-4 give us the permissions that the "user" who owns the file (ewennstr, in this case) has. In this case, that's reading (r) and writing (w), but not executing (x), so we couldn't run this as a script (which is fine because it isn't a script). Characters 5-6 tell us the permissions for anyone in the "group" that the owner belongs to (faculty, in this case). Characters 7-9 tell us the permissions that any "other" account logged into Silo has. Right now, the only person who can read the file or write to it is ewennstr. Let's make it so that everyone can read the contents of the file, but not change it. We use the chmod
command to "change" the "mode" of the file.
[ewennstr@silo homework]$ chmod a+r one
[ewennstr@silo homework]$ ls -l
total 4
-rw-r--r-- 1 ewennstr faculty 128 Jun 20 12:19 one
There are lots of ways to use the chmod
command. (You can read about it at Wikipedia, if you like. Or you can type in the command man chmod
to read the manual for the command. In fact, you can do that for any Unix command.) In this case, we added (+) the read (r) permission for all users (a). Now you can see that the group and other permissions now include the ability to read the file.
While we're at it, why don't we change the permissions for the entire "homework" directory? We go up a directory using the cd
command again. "..
" always refers to the parent directory of the current directory.
[ewennstr@silo homework]$ cd ..
[ewennstr@silo ~]$ ls -l
total 96
drwxr-xr-x 18 ewennstr faculty 4096 Jun 18 14:36 apache
drwx------ 2 ewennstr faculty 4096 Sep 10 2010 bin
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Desktop
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Documents
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Downloads
drwx------ 2 ewennstr faculty 4096 Jun 20 12:19 homework
drwx------ 12 ewennstr faculty 4096 Jun 15 15:40 httpd-2.2.27
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Music
drwx------ 18 ewennstr faculty 4096 Jun 17 16:54 mysql
drwx------ 33 ewennstr faculty 4096 May 6 06:46 mysql-5.6.19
-rw-r----- 1 ewennstr faculty 26404 Jun 17 16:54 mysqld-error.log
drwx------ 18 ewennstr faculty 4096 Jun 18 14:20 php-5.5.13
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Pictures
drwxr-xr-x 2 ewennstr faculty 4096 May 30 11:36 Public
-rw------- 1 ewennstr faculty 485 May 20 10:15 README
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Templates
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Videos
The directory homework has permissions drwx------. The first character "d" means that it's a directory. The user (ewennstr) has permission to read (see its contents), to write (add files to the directory), and to execute (which for directories mostly means to be able to use cd
to change into that directory). Nobody else has any permissions. We'd like for other people to be able to see the directories contents and to access the directory with cd
, so let's do that.
[ewennstr@silo ~]$ chmod a+rx homework
[ewennstr@silo ~]$ ls -l homework
total 96
drwxr-xr-x 18 ewennstr faculty 4096 Jun 18 14:36 apache
drwx------ 2 ewennstr faculty 4096 Sep 10 2010 bin
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Desktop
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Documents
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Downloads
drwxr-xr-x 2 ewennstr faculty 4096 Jun 20 12:19 homework
drwx------ 12 ewennstr faculty 4096 Jun 15 15:40 httpd-2.2.27
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Music
drwx------ 18 ewennstr faculty 4096 Jun 17 16:54 mysql
drwx------ 33 ewennstr faculty 4096 May 6 06:46 mysql-5.6.19
-rw-r----- 1 ewennstr faculty 26404 Jun 17 16:54 mysqld-error.log
drwx------ 18 ewennstr faculty 4096 Jun 18 14:20 php-5.5.13
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Pictures
drwxr-xr-x 2 ewennstr faculty 4096 May 30 11:36 Public
-rw------- 1 ewennstr faculty 485 May 20 10:15 README
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Templates
drwxr-xr-x 2 ewennstr faculty 4096 Sep 8 2011 Videos
The permissions are now drwxr-xr-x, so mission accomplished!
Feel free to mess around with other Unix commands. I wouldn't alter or delete any existing files, but you can do pretty much whatever you want with files or directories you've added. You can also use the man
command to see the manuals for various Unix commands.
In lecture today, you saw a glimpse of the following Unix commands:
cd
ls
and ls -l
cat
mkdir
rm
chmod
pwd
cp
exit
man
We also used the Pico text editor and we talked about the directory shorthands .
, ..
, and ~
.
Remember that when you're done creating your directory and file and adjusting their permissions, you should send me an e-mail to indicate that you've completed homework assignment #1.