The laboratory activities and programming assignments of 15-110 require the use of computer systems running a version of RedHat Enterprise Linux adapted for the CMU environment called "Andrew Linux" and using a graphical interface known as the GNOME Desktop. This document describes how to perform some of the basic operations within that environment.
There are several application/utility programs that we will use in this class. These include:
gedit &" on the command-line.
Since the contents of each file is just a sequence of bits, the computer needs to apply rules to decode the contents of the file as, for example, a JPEG image, a Word document, a text file, etc. In many operating systems, file name extensions (the last part of the file's name, after the last period) are used to indicate the files format (that is, which set of rules should be applied to interpret the contents of the file). Windows and Windows programs tends to hide these extensions from the user, adding them and acting based on them automatically. In Linux, the filename extensions are treated mostly as a normal part of the name that the user can choose however they want. Most files, though, are given extensions that reflects their contents, and these extensions are used by programs and the user as advisory information on the likely contents of a given file.
A directory (= folders) can also contain other directories, which are often (but not always) referred to as subdirectories (nested folders). The directory in which a subdirectory is contained is referred to as that subdirectories "parent directory". The nesting of directories can is often thought of as forming a "tree" that branches out from a single "root" directory with smaller branches (subdirectories of the root directory) coming of it, even smaller branches (subdirectoreis of the subdirectories comming from the even smaller branches, and so on.
In Linux, the "/" (slash) character is used to separate a directory from its contents (In Windows, "\" (backslash) is used for this purpose.), and can be used to create "paths" that identify files stored on the computer. For example, the path /afs/andrew.cmu.edu/usr22/vonronne/public/15110/bin/lightbotchecker.py denotes the file lightbotchecker.py inside the bin directory that is inside the 15110 directory that is inside the public directory that is inside the "vonronne" directory that is inside the usr22 directory that is inside the andrew.cm.edu directory that is inside the afs directory inside the computer system's root directory.
(The systems at CMU are setup, using the Andrew File System (AFS), so that the afs directory inside root is shared, and will look the same, on any Linux machine running AFS. (The AFS subtree is also available on Windows machines, but it will have a drive letter instead of being found at /afs.)
In Linux, each user is normally given a "home directory" as a place for them to store files. The symbol "~" is used to refer to the current user's home directory. And for any user usr, ~usr refers to that user's home directory. So, for example, since the directory /afs/andrew.cmu.edu/usr22/vonronne/ is the user vonronne's home directory, it can be referred to as ~vonronne, and the file /afs/andrew.cmu.edu/usr22/vonronne/public/15110/bin/lightbotchecker.py can be referred to as ~vonronne/public/15110/bin/lightbotchecker.py. Furthermore, the user vonronne can also refer to the same file using the path ~/public/15110/bin/lightbotchecker.py.See also Computing Services' Using Unix & the Andrew System.
On Andrew Linux machines, directories can be created, files can be moved, etc., using the GNOME File Browser or from a command line within a terminal.
You can use the GNOME File Browser (a.k.a. Nautilus) to browse your home directory. You can get their either by clicking on the home folder icon on the background of your desktop or by selecting "Home folder" under the "Places" menu at the top of the screen. (If you get asked whether you want to use Nautilus or Thunar as your file manager, choose "Nautilus".)
Once opened, the GNOME file manager can be used to explore your home directory, create folders, delete folders, and files, and compress files. (See the "File" and "Edit" menus.)
For each programming assignment, as well as several of the lab activities, you will be asked to create and handin a zip file. A zip file is a way of bundling multiple files (perhaps organized into directories) into a single file so that it takes up less space and is easier to move around.
One way to create such a zip file is as follows:
"What if there is no 'Compress' in the 'Edit' menu of the File Browser after a file is selected?" This can occur if your account has become configured to use Thunar instead of Nautilus as the default file browser. If you have this problem, running the following command in a terminal should fix the problem:
cp -b ~vonronne/public/15110/xfce4-helpers.rc ~/.config/xfce4/helpers.rc
After executing this command, if you re-open the File Browser from the "Places" menu, you should get the Nautilus File Browser.
If, however, the cp command resulted in the error message, "cp: cannot create regular file", then your problem probably wasn't that you were running Thunar instead of Nautilus. Double check again that there really is no "Compress" in the "Edit" menu when you have files selected in the File Browser.
In addition to using the GNOME desktop environment, you can also interact with the systems in the Gates Hall Cluster using the "command line." If you're sitting at the machine, you get a "command line" using the "Terminal" program listed under the "Applications"/"System Tools" menu.
This will create a terminal window that contains a black space with a white prompt that says something like [vonronne@ghc15 ~]$ where the vonronne indicates the currently logged in user, the ghc15 the machine that user is sitting at, and the ~ indicates the "current directory", which many commands will operate on implicitly.
You can type commands after the prompt and upon hitting enter they will be executed. For example, if you enter the command ls, you will get a listing of the files in the current directory, which in this case would be vonronne's home directory.
A description of a few basic commands can be found as part of Using Unix & the Andrew System.
Here is an example command-line session of the user vonronne creating a directory for 15110 within the private directory in his home directory.
[vonronne@ghc15 ~]$ cd [vonronne@ghc15 ~]$ ls 15110 Documents OldFiles Videos public Desktop Downloads Templates private www [vonronne@ghc15 ~]$ cd private [vonronne@ghc15 ~/private]$ ls [vonronne@ghc15 ~/private]$ mkdir 15110 [vonronne@ghc15 ~/private]$ cd 15110 [vonronne@ghc15 15110]$ pwd /afs/andrew.cmu.edu/usr22/vonronne/private/15110 [vonronne@ghc15 15110]$ cd [vonronne@ghc15 ~]$ ls private 15110
[vonronne@ghc15 ~]$ cd [vonronne@ghc15 ~]$ ls private 15110 [vonronne@ghc15 ~]$ cd private/15110 [vonronne@ghc15 15110]$ mkdir lab2 [vonronne@ghc15 15110]$ cd lab2 [vonronne@ghc15 lab2]$ ls [vonronne@ghc15 lab2]$ gedit lab2.txt
[vonronne@unix13 ~]$ cd [vonronne@unix13 ~]$ cd private/15110 [vonronne@unix13 15110]$ ls examples lab1 pa1 [vonronne@unix13 15110]$ zip -r pa1.zip pa1 adding: pa1/ (stored 0%) adding: pa1/lb1.txt (stored 0%) adding: pa1/lb2.txt (stored 0%) adding: pa1/lb3.txt (stored 0%) adding: pa1/lb4.txt (stored 0%) adding: pa1/lb5.txt (stored 0%) [vonronne@unix13 15110]$ ls examples lab1 pa1 pa1.zip [vonronne@unix13 15110]$