Dana Vrajitoru
C151 Multi-User Operating Systems

Lab 0

Due Date: Tuesday, January 26, 2021.

Ex. 1. Login and Setup.

In this lab we will do an introduction to Linux, make sure that you can log into our system, and see some of the operations that can be done through a terminal.

Most of this lab will be done in a terminal-type session. If you work directly on one of the Linux machines in our labs, then all you have to do is open a terminal. If you are working from a Windows or Mac machine, you will need an application (putty or terminal) that connects remotely to one of our Linux computers in the labs with a terminal-type session. Instructions for each situation are found below in the section Tools. Note that only one of the paragraphs of that section applies to you (you must choose it based on your computer type).

Your IU username and password, that you use to access the IU sites and log on to the campus computers, should now also be working to login on Linux. If not, contact me or our lab administrator Will Keeler (NS #203, wkeeler at iusb dot edu).

Note. The login prompt is setup not to echo anything when you type in the password. Whatever you type is still input normally, you just don't see anything. Also, if you attempt to login and fail for 5 times within 5 or 10 minutes, your home computer will be blacklisted, so if you fail to login 4 times, take a break of a few minutes before you try again.

Tools

Starting up. Follow the instructions for the type of system that you are working on.

  • If you work on a Linux machine, log on and launch a terminal.

  • If you work on a Mac machine, launch a terminal and then run the command:

    ssh cs##.cs.iusb.edu -l username -XY

    where ## means a 2-digit number between 01 and 03. You may have to try several numbers to find one that works because some of these computers may be booted in Windows or MacOS, in which case they will not respond to this command. Replace "username" with the name of your account. This opens a remote secure session on the machine that you specified. You will be prompted for a password.

    Here is an example of a connection being established.


  • If you work on a Windows machine, launch Putty and type the following as the Host Name:

    cs##.cs.iusb.edu

    where ## means a 2-digit number between 01 and 03. Make sure that the connection type is SSH, like in this example.


    You may be asked to confirm that you want to connect to this machine by a security alert system the first time you log on to a particular host, like in this example.


    Just answer yes. A terminal window will open where you will be prompted to enter your username and password, like in this example.


    These should be your usual IT information. You may have to try several computer numbers until one works (see Mac section above).

    On your home computer, you may want to bookmark the session information for easy access. You can enter the username and remote host name, then give it an easy name to remember in the Saved Sessions box, and click Save. After that you'll be able to launch the session again by double-clicking on the bookmark name in the list. It is not recommended to save the password.

    To make it easier to save the terminal, you can click on the little icon in the top-left corner of your putty window, and from the pop-up menu, choose "Change Settings". There you can click on Logging, and check the "Printable output" option or the "All session output". Then hit the Browse button to choose where to save the session under the name "putty.log" or whatever name you choose for it. That file, that you can rename later as "lab0term.txt" or "hw1.txt" or whatever name is appropriate for your session, will be part of what you turn in for this lab and for most of the labs and homework assignments.

    Ex. 2. Introduction to some shell commands.

    Your working (or current) directory when you login is called your home directory. It is a folder named after your username and located in a folder called /home. Most commands will apply by default to files in your working directory, and a little later you'll learn how to change it. To see the path of the working directory, type the command pwd, then hit the Enter key. It stands for Path of the Working Directory.

    A command is a small executable that performs some operation involving the file system, the processes, or the operating system. For example, the command ls stands for "list" and will display a list of the files residing in the current working directory. Try it.

    Commands can have arguments specifying what they apply to. For example, for the command ls, we can ask it to list the files in a different directory than the current one by providing this other directory as an argument (/var/log/ in the following case):

    ls /var/log

    Commands can also have options that modify the way they are executed. For example, an option for the command ls would be "-l" (lowercase El) that makes it display the list of files with a long list of properties or attributes:

    ls /var/log -l

    Arguments and options are usually flexible. Try the previous command again while swapping the places of the option and the argument. The result should be the same.

    Options can be provided separate, or grouped together. For example, the option -a for the command ls will also display hidden files. If we want to run this command with both the options -a and -l, we can have them both separated by a space, or use -al instead. Thus, the following three commands should be equivalent (make sure they are):
    ls -a -l
    ls -l -a
    ls -al

    If you are not sure about what a command does and what options can be used with it, the easiest way to find out is with the command "man", which is short for manual (q to exit):
    man ls

    Commands we'll use below:

    Practical:

    Ex. 3. Saving the content of your terminal.
    Ex. 4. Using alpine to send an email.
    Canvas Submission.

    Submit the file lab0term.txt containing the text in the terminal for exercise 2 to Canvas. Under Assignments there is a section called Lab 0 where you can submit it. The lab is due next Tuesday at 11:59pm.