Skip to main content

Lab: Getting started with GNU/Linux

Held
Friday, 25 January 2019
Writeup due
Monday, 28 January 2019
Summary
This laboratory reviews some mechanics related to the use of the Computer Science GNU/Linux Network for CSC 151.

Introduction

This lab gives you the opportunity to explore (or at least configure):

  • Logging In
  • The Xfce window environment
  • Practice with a terminal window: Setting up your account
  • Firefox
  • gedit, our text editor
  • Working with multiple desktops
  • Finishing up and logging out

Please don’t be intimidated! Although this lab contains many details which may seem overwhelming at first, these mechanics will become familiar rather quickly. Feel free to talk to the instructor or with a CS tutor if you have questions or want additional help!

Logging in

Short version

  • On the computer in front of you, you should see a small window that asks you to log in. If you don’t see such a window, try hitting a key on the keyboard or clicking the power button on the monitor.
  • Enter your user name. Press the Enter key.
  • Enter your password (which won’t appear on the screen). Press the Enter key.
  • Get help if those previous two steps don’t work.

Detailed version

To use any of the computers on Grinnell’s GNU/Linux network, one must log in, identifying oneself by giving a user name and a password. MathLAN workstations are configured to use the same username and password as other Grinnell services. If you do not know your Grinnell username or password please tell the instructor soon; we will need to contact ITS to reset your account information.

When a GNU/Linux workstation is not in use, it will display a login screen with a space into which one can type one’s user name and, later, one’s password. (If the workstation’s monitor is dark, move the mouse a bit and the login screen will appear.) This window belongs to xdm, the Xwindows Display Manager. Now, move the pointer onto any part of the box containing the login box. Type in your user name, in lower-case letters, and press the Enter key. The login screen will be redrawn to acknowledge your user name and to ask for your password; type it into the space provided and press Enter. (Because no one else should see your password, it is not displayed on screen as you type it.)

At this point, a computer program that is running on the workstation contacts the College’s authentication server to validate the user name and password. If it does not find the particular combination that you have supplied, it prints a brief message saying that the attempt to log in was unsuccessful and then returns to the login screen – inviting you to try again. Consult the instructor or the system administrator if your attempts to log in are still unsuccessful. (Make sure that you don’t have any spaces before your username; that’s one of the most common errors.)

The Xfce window environment

Short version

  • You’ll see something that looks somewhat like Microsoft Windows, but also somewhat different.
  • Icons at the bottom of the screen can be used to start programs.

Detailed version

Once you have logged in, a panel will appear at the bottom of the screen. Some other windows also may be visible in other parts of your screen. All of these areas are managed by a special program, called a window manager. On our network, login chores and other administrivia are handled by a program or operating system, called GNU/Linux, and the primary user interaction is handled by a window manager (GUI), called Xfce.

Practice with a terminal window: Configuring your account

Short version

  • Click on the icon that looks like a computer screen showing a greater-than sign and an underscore. (If you have no such icon, click on the Applications menu on the lower left corner of your screen. Then, select System and Xfce Terminal.) A window will appear that will let you type.
  • Type /home/rebelsky/bin/csc151-setup and then hit the Enter You should see a series of messages about the configuation of your account.
  • Type exit and then hit the Enter key to close the window.

Detailed version

While we can run several programs by clicking on their icon, we will need to invoke others by name. The computer program that reads and responds to such invocations is called the shell, and your interactions with the shell takes place in a window generated by a program called a terminal emulator, or terminal for short.

You may already have a Terminal window on screen. If not, look for an icon of a computer monitor near the lower-left corner of the screen with a greater-than sign and an underscore. If you see this icon, move the pointer over the icon and click the left mouse button once to launch the Terminal.

If you do not see a Terminal icon, then move the pointer onto the Applications menu icon at the bottom left of the panel (in Xfce, it looks like a creature on a blue X) and click once with the left mouse button. The applications menu will pop up. Move the mouse over System, then Xfce Terminal Click the left mouse button once to launch the Terminal.

In the terminal window, you will see a shell prompt – the name of the workstation on which the shell is running, followed by a dollar sign. This prompt indicates that the shell is ready to receive instructions.

You type in such instructions using the keyboard. Move the mouse pointer into the Terminal window and click the left mouse button to make the window active. Notice that the window frame changes color following the click, indicating that the window has become active.

To get rid of the Terminal window, press Ctrl+D. That is, hold down either of the keys marked Ctrl, just below the Shift keys, and simultaneously press the D key. (On our workstations’ keyboards, the keys marked Ctrl (“control”) and Alt (“alt” or “meta”) are somewhat like Shift keys, in the sense that they modify the effect of other keys that are pressed simultaneously.) The shell program interprets Ctrl + D as a signal that you have no more instructions for it and halts, and the terminal emulator closes the window automatically once the shell stops running. Alternatively, you may close a window by moving the mouse to the x at the top-right of the window, and clicking the left mouse button. Finally, you can usually type exit to close a terminal window.

If you just followed those instructions to close your terminal window, open a new one. Otherwise, you can continue to use the terminal window you have visible.

Type /home/rebelsky/bin/csc151-setup. That’s a script that sets up your account for the kind of work that we’ll be doing in this class.

A typical interaction to set up the account looks something like the following.

fraenkel$ /home/rebelsky/bin/csc151-setup
$ /home/rebelsky/bin/csc151-setup
CSC 151: Adding default setup for DrRacket
CSC 151: Configuring Racket to look for Racket files on the desktop.
CSC 151: Checking on class software
CSC 151: Installing loudhum package.  Ignore the long series of messages.
Querying Git references for loudhum at https://github.com/grinnell-cs/loudhum.git
Downloading repository https://github.com/grinnell-cs/loudhum.git
raco setup: version: 7.1
raco setup: platform: x86_64-linux [3m]
...
raco setup: --- post-installing collections ---

CSC 151: Done!

fraenkel$

Firefox

Short version

Detailed version

While some materials for this course will be available in paper, almost everything for this course (including electronic versions of paper materials) will be available on the internet. To use Firefox to view materials, such as this course’s syllabus and this lab, you may follow these steps:

Click the Firefox icon on the panel, next to the Applications menu. The Firefox icon is a small red creature (presumably a fox) holding a bluish sphere.

If you do not see the Firefox icon, then move the pointer onto the Applications Menu icon at the bottom left of the panel (in Xfce, it looks like a creature on a blue X) and click once with the left mouse button. The applications menu will pop up. Move the mouse over Internet, then Firefox. Click the left mouse button once to launch Firefox.

The materials for this course will walk you through using the Firefox web browser, but a version of Chrome called the Chromium Web Browser is available on MathLAN workstations as well in the Applications menu under the Internet section. Almost all of the materials for this course will be distributed over the Web. You can add this browser your panel if you prefer. (You can add something to your panel by dragging it from the menu to the panel.)

The first time you run Firefox on our network, two message boxes might appear.

  • One box might ask you to consent to the terms of a licensing agreement.
  • One box might request permission to create some configuration files in your home directory.

You should approve of any requests by clicking on the appropriate word. The pop-up boxes then disappear; you should not see them on subsequent uses of Firefox.

Initially, Firefox displays a document containing some default information. You should navigate to the course website at http://www.cs.grinnell.edu/~rebelsky/Courses/CSC151/2019S.

We expect that most of you are already familiar with a Web browser. If not, please consult with one of us or with one of your colleagues.

Firefox options

Short version

  • Click on the menu icon (a set of three lines) in the upper-right-hand corner of the screen.
  • Click on the Preferences button, which also has a gear icon.
  • Update your home page to something reasonable like this course’s website at or the Grinnell Office365 page.
  • Quit and restart Firefox to verify that your new home page appears. If you see something other than your home page (e.g., the Grinnell College home page), then ask for help.

Detailed version

Each GNU/Linux user can configure Firefox to reflect her, his, zir, or their own preferences. Between logins, these preferences are stored in a file in the user’s home directory; when Firefox is started during a later session, they are reinstated from that file.

Every user of Firefox in this class should establish a base page, a starting point for browsing. Here are the Uniform Resource Locators or URLs of some good choices:

To establish your base page within Firefox, bring up the primary Firefox menu from the menu bar by clicking on the icon with three lines in the upper-right-hand corner of the window. Then select the Preferences operation. A pop-up window appears, allowing you to configure many features of the general appearance of Firefox. Choose the General option, if it has not been chosen already. The rectangle labeled Home Page contains the URL of some document that serves as the default. Replace the contents of this rectangle with the URL of your choice. (This does not have to be a permanent change; you can change your mind about this configuration at any time within Firefox.)

To erase the current contents of the Home Page Location(s) box, move the mouse pointer to the left of the first character in the box, press the left mouse button and hold it down, and drag the mouse pointer rightwards until the entire URL is displayed in reverse video, white letters on a black background. Then release the left mouse button and type the new URL; the old one will vanish as soon as you start typing. Once you have entered the new URL, move the mouse pointer onto the button marked OK at the bottom of the pop-up window and click on it with the left mouse button.

You can, of course, simply navigate to the page you want to use as your home page and then click on Use Current Pages.

You may note that the button says “Pages” (plural) rather than “Page” (singular). Since Firefox permits tabbed browsing (that is, you can have “tabs” within the same window that you switch between), you can have a home set of tabs. Particularly obsessive people might want to set up a sequence of tabs with say, links to labs, readings, and beyond.

Note that some folks have a default launcher for Firefox that is configured to start the web browser on a specific page, regardless of the home page you choose. If you don’t see your new home page when you restart Firefox, then ask for help.

Enabling Scripts

As you may know, there has been a rise in malicious programs (scripts) that reside on Web pages. For that reason, our system administrator has installed the NoScript plug-in which, by default, disallows scripts from every site. The relatively recent Spectre bug illustrates one reason that our SysAdmin disallows scripts.

However, many common services on campus, including this website, Office365, and PioneerWeb, rely on scripts. Hence, we recommend that you enable scripting for sites in the grinnell.edu domain.

  • Navigate to the course website if you haven’t already: http://www.cs.grinnell.edu/~rebelsky/Courses/CSC151/2019S.
  • You should see a blue S with a red slash through it near the upper-right-hand corner of your window and the text “Scripts Currently Forbidden” at the bottom of the window.
  • Click on the S button. It will bring up a menu.
  • Click on Allow all this page. In some versions of NoScript, you may need to click on another S button whose hover text says something like “Trusted”.
  • Verify that the S icon no longer has a red slash.

This will allow scripts from the grinnell.edu domain, as well as a few other trustworthy script hosts that are used on the course website.

If you like to live dangerously, you can also allow scripts globally. We’ll leave it to you to figure out how to do so.

Using gedit

gedit is the preferred text editor for the course (and, conveniently, for Xfce). To access gedit, click on the Applications menu at the lower-left-hand corner, then Accessories, then Text Editor. A window should appear.

Quit gedit to prepare for the next step.

In the future, you will find it easier to access gedit if you have it in your task bar. Go back to the Accessories menu and then drag the Text Editor icon to your task bar. If all goes well, you see a new icon there.

Click on the icon. You should see a new gedit window. (If you didn’t close gedit previously, you may just see a new tab in the gedit window.)

Enter some text in the window and then save your file on your desktop with the name “myfile.txt”.

In Firefox, enter the following URL, substituting your own username for the text username: file:///home/username/Desktop/myfile.txt.

Working with multiple desktops

If you’ve kept all those windows open, you’ll notice your screen is getting a bit crowded. Fortunately, a tool called the workspace switcher lets you uncrowd your windows by moving them among multiple desktops.

Short version

  • Find the workspace switcher icon in the workspace toolbar.
  • Click on the switcher to move to a different desktop.
  • Drag windows within the switcher to move them to other desktops.

Detailed version

In the toolbar at the bottom of the screen, you should see an icon that looks like a box containing four smaller boxes. (If you don’t see it, ask for help.) This is the workspace switcher, a tool that lets you keep your application windows on several different desktops or workspaces.

The upper-left-hand box represents the desktop you are working on right now. It contains a number of still smaller boxes of varying shapes and sizes, which represent the windows you have open. When you move or resize the a window on the desktop, you should see the window’s representation in the switcher move as well. Give it a try by wiggling one of your windows around.

Now, click in one of the other three boxes. You should see a new, blank desktop with no windows on it. Where did they go? If you look at the switcher, you’ll see they are still in the desktop you started on. Switch back to that desktop.

You can also use the switcher to move windows from one desktop to another. Find the switcher again and identify the box that corresponds to your Firefox window. Click that box and drag it a little ways to the right, onto the next desktop. The window should disappear from the first desktop. If you click onto the desktop to the right, you should see it there.

In this class, you’ll usually need to work with multiple windows: The DrRacket window for your programs, a terminal window or two, and a Web browser to read the laboratory exercises and reference materials. As you get settled in over the next few weeks, consider how you might use the switcher to help you organize your workspace efficiently.

By default, the workspace switcher presents four workspaces arranged in two rows of two each. If you want to change this configuration, right-click on the workspace switcher and select Properties to change the number of rows. Clicking on Workspace settings… will let you change the number of workspaces.

Caution: If you use the mouse scroll wheel while your cursor is over the empty desktop area, you will switch workspaces. This sometimes alarms students as it appears to have closed all of your running applications. You can switch back to the correct workspace by clicking in the workspace switcher. If this bothers you, you may want to reduce the number of workspaces to just one.

Finishing up and logging out

If you’ve successfully logged in, started Firefox, selected your home page, tried DrRacket, configured your account, and played with multiple desktops, you’ve completed the lab and you can finally stop.

Short version

  • To log out, click on the icon at the lower right corner of the screen, and select Log Out.
  • Do not turn off the monitor or computers.

Detailed version

When you are done using a workstation, you must log out in order to allow other people to use it. To log out, move the pointer onto your username, at the lower right corner of the screen, and click the left mouse button. A menu will pop up giving several options. Move the pointer onto the words Log Out at the bottom of the menu and click the left mouse button. A confirmation dialog will appear, giving you 30 seconds to change your mind. Click the Log out to log out immediately. The Xfce window manager vanishes, and after a few seconds the login screen reappears; this confirms that you’re really logged out.

Please do not turn off the workstation when you are finished. The GNU/Linux workstations are designed to operate continuously; turning them off and on frequently actually shortens their life expectancy. Modern computers use very little power when they are sitting idle, so this is not a significant waste of resources.