Modern versions of Linux allow an experienced computer user to do normal computing tasks immediately without any additional training, but to begin to harness some of the power of Linux a little work is required. In particular, much of the power of Linux and other Unix variants can be found in their command line interfaces (CLIs). Many current users of Microsoft and Apple operating systems have little experience with CLIs and are only used to graphical user interfaces (GUIs). The purpose of this exercise is to you expose to the Linux CLIs in order to give you the experience necessary to be more productive using Linux and other Unix operating systems in the future. Note that if you find the Unix tools that you will learn about here useful, there are options for available for installing them on your Microsoft Windows computers. MacIntosh OS X users will find that most of the tools mentioned here are already installed on their computers (though they may not be well advertised), and the once that are not can be downloaded fairly easily.
You will probably find many occasions during this lab when you will want to transfer files back and forth between your Windows and Unix accounts. While there are many ways to do this (including email them to yourself, put them a USB drive, or on a CD), the easiest ways involve transferring the files directly between the accounts involved. To get this to work takes some setup. In this section you will see how you can get direct access to your Windows files from Linux, and vice-versa.
Also note that you can run a single Linux terminal window using ssh (https://sharepoint.csbsju.edu/itservices/kb/Pages/linux_ssh.asp) or a remote Linux desktop using NX (https://sharepoint.csbsju.edu/itservices/kb/Pages/misc_freenx_41.aspx) on your own computer. You can also run some campus Windows programs using Citrix (https://sharepoint.csbsju.edu/itservices/kb/Pages/citrix_default.aspx) — you will use this below.
webdavs://WINDOWS_USERNAME@homedir.csbsju.edu/homedir/WINDOWS_USERNAME,
where you should replace WINDOWS_USERNAME with you username. When you attempt to go to that link, you should be prompted for your password. This should allow to to move files between your accounts using Konqueror by using Konqueror as a file manager similar to Microsoft’s Windows Explorer. You can drag and drop files, etc.
https://homedir.csbsju.edu/homedir/WINDOWS_USERNAME.
While these directions are for accessing Linux files from Windows, we are going to set it up using Citrix, a program which lets you run Windows programs from Linux.
\\samba.csbsju.edu\YOUR_UNIX_USERNAME
where you should replace YOUR_UNIX_USERNAME with your Unix username (e.g. abstuden).
Before we get to learning about the Linux CLI, I would like you to play around a bit with the Linux GUI. Explore the menus. Try out a few programs. Change some of the settings (maybe the wallpaper?). Then pick a game (alas, there used to be more choices) that you have never played before and try it out for a few minutes. Record down the name of the game, how it works, and what score you got (if the game has a score) in your lab notebook. Or since their are so few games, try another program that you have never used before, play with it, and write notes on what you have tried. Some good ones to try include gimp (Gnu Image Manipulation Program - under “Graphics” on the menu), xfig (also under “Graphics”), or Aladin (under the “CSBSJU—Physics” menu.
The Unix tutorial at http://www.ee.surrey.ac.uk/Teaching/Unix/index.html will be the focus of this exercise. Start at the first section and work your way through the entire tutorial.Make sure that you do all of the exercises listed.
The tutorial is setup for users at another college, but all of the commands in it should work here as well, though the file paths are different. Another thing to note about the tutorial is that it uses the command shell called csh. Here at CSB/SJU we use another shell, tcsh which is based on csh, but has some more advanced features. This should not be a problem because tcsh is more or less a superset of csh, so you should be able to do everything in the tutorial. Note, though that there are other shells that are not as compatible with tcsh. In particular, the most commonly used shell on Linux is bash and bash has many syntax differences from tcsh. If you would like to try a different shell, you can type its name at the command prompt. You can also change your default shell, but I wouldn’t recommend that at this point.
To run through this tutorial you should log into one of the department’s Linux computers. Start up a web browser — Firefox, Google Chrome, Konqueror, or any other browser should work fine — and go to the page mentioned above. To run the examples described in the tutorial you will also need to have a terminal window (also known as a command shell) open. There are several types that will work: xterm, konsole, gnome-terminal, and rxvt to name a few. You should be able to find them under one of the menus in the GUI.
For this exercise, you need to keep a record of the commands that you typed. I recommend that you use the script command to do this. After you open a terminal type: script tutorial.txt — where “tutorial.txt” is the file name that your commands will be saved in. When you are done with you session, type “exit” and it will be saved. If you have to stop this exercise and start it up again you will want to use a different file name the second time (e.g. script tutorial2.txt, otherwise you will lose your work from the first file.
Note that for this exercise each of you should work on your own. You are free to ask for help from other students, but do the entire tutorial yourself.
Before you get started let me add a couple more time saving hints. In tcsh (and bash), you can scroll through previous commands that you have typed with the up and down arrow keys. This is a big time saver if you make a typo. “Tab completion” is a related feature. When you are typing the name of a command (or file), if you hit the “Tab” key, bash will attempt to complete the command (or file) name for you.
Also, Unix (or more accurately the X Windows System which provides the GUI for most Unix systems) has several methods of copy and pasting. The Unix style way of copy and pasting is to select text using the left mouse button, then move the pointer to the place you want to paste to, and then click the middle mouse button. Try it one or twice. Copying and pasting this way would make it quite easy to do this entire assignment without doing any typing, but I suggest you type most of the commands given, since that will make it more likely that you will remember them. Many programs also support the Microsoft Windows style copy and pasting from their “Edit”menus (also available using Control-C, -V, and -X). Another trick with the middle mouse button involves web browsers. If you middle click on a link in most Unix browsers, the linked page will open in a new tab or window. Also, if you select the text of an URL with the left mouse button, and you paste to a blank spot on web page, the URL will be loaded on the browser. (You can also configure Firefox to act this way on Windows and Mac computers.)
Also, if you get stuck while running a program from the terminal try hitting Control-C, which should exit out of the program. If that does not work, you can also try Control-Z, which suspend the program.
Another useful command is finger. Try: “finger YOUR_USERNAME” and “finger jcrumley”.
After completing the tutorial, do the following tasks:
Hand in your lab notebook when you are done with this exercise.