MTU CS Lab:FAQ

From CSL Wiki
Jump to: navigation, search

Contents

Computer Access

I'm not familiar with Linux, how do I use it?

A Linux Quick Reference sheet is available for print or download at http://www.cs.northwestern.edu/academics/courses/322/refs/linux.pdf

Linux includes a couple Graphical User Interfaces (GUIs) which are good for launching applications and behave similarly to the familiar Windows. However, some of the more powerful tools of Linux are the shell commands. You can open a shell (also called a terminal window) by double-clicking on the "Terminal" icon on your desktop, or by right-clicking on your screen and selecting "Open in Terminal".

How to remote login from home?

It is recommended that you login to wopr.csl.mtu.edu using ssh. If you are trying to access from windows machine, there are a lot of softwares available for this purpose. One such software is PuTTY. You can download it from http://www.putty.nl/latest/x86/putty.exe.

How to transfer files from home?

You can transfer files using ssh or sftp. The recommended host is wopr.csl.mtu.edu. For windows, WinSCP is perhaps the most common software used for this purpose. Visit http://winscp.net/eng/download.php to download WinSCP.

How to login to guardian?

Guardian is a SUN machine running Solaris Operating System. Some classes, for example cs3911, may require students to do projects using software under Solaris Operating System. Currently guardian is located in a secure server room and students do not have access to the physical machine. There are a couple of ways to remote log in to guardian:

  1. If you are using the CS lab machines or any Unix/Linux machines within the MTU network, first log in to the local PC, them open a terminal and type the command ssh guardian. Then when prompted, enter your NIS password - which is your M-number initially.
  2. If you are using a Windows machine within MTU network, you can use putty to login to guardian. (The host name would be guardian.)
  3. If you need to login to guardian from home, you can try ssh or putty as in the steps above. Because of the access control set up on guardian, you may get "connection refused"; it depends what ISP you use. If so, please login to the remote server (wopr.csl.mtu.edu or joshua.csl.mtu.edu) first and then run the command ssh guardian.csl.mtu.edu.
  4. You can also set up public key authentication over SSH. That way, you don't need to type your password to login into any cs or csl machine.Here are the steps:
    1. Login into any csl machine, for example wopr.csl.mtu.edu
    2. In terminal, run ssh-keygen -t rsa. Press enter to accept the default filename, then press enter twice to accept empty passphrase
    3. Create a new file called authorized_keys under ~/.ssh/ and copy the content in ~/.ssh/id_rsa.pub into the newly created file
  • Note: Depending on where you are logging in from, you may get away with including less of the name on the command line. For example, if you are using ssh to login from off campus, you will need the full name guardian.csl.mtu.edu. If you are logging in from campus, but not the CS lab, you can use guardian.csl. And finally, if you are logging in from the CS lab, you can just use guardian.

If you still have problems to login after trying, contact csmaint@mtu.edu with detailed error description.

To verify that you have logged into guardian, use the hostname command. (See How to check the name of the computer you are using? listed below.)

Printing

How to print a PDF file?

Adobe Acrobat Reader is the default program for pdf files. To print a file from Acrobat, select print from file menu or click printer icon on the toolbar. Then select printer from drop down list. Adjust other properties as per your requirements and click OK. The screenshot below uses laser113.

How to print a PDF file from command line?

Use the following command:

$lpr -Pprinter_name filename.pdf

If you want to print a file named assignment.pdf at printer laser112:

$lpr -Plaser112 assignment.pdf

If you don't specify the printer, the file is printed at the default printer. The default printer is the nearest printer from your computer. It is set in the environment variable PRINTER. You can view the current default printer using the following command:

$echo $PRINTER

My PDF prints smaller and smaller pages, how can I fix that?

The problem has to do with Adobe's duplexing not working with our printing setup. The solution is to turn off Adobe's duplexing and just send the document to one of our duplexing print queues.

To turn off Adobe Reader's duplexing function for a document:

  1. Click on "File" on the menu bar.
  2. Select "Print..." from the dropdown menu.
  3. In the Print Dialog window, select one of the duplex printing queues (The duplex printing queues have a "d" at the end of the printer name.)
  4. Click on the "Properties" button in the upper right corner of the Print Dialog window. (It may take a while for the Properties window to open up.)
  5. Where it says "Duplex Printing", change the option to "Off".
  6. Click "OK" to save the change.
  7. Make any other adjustments you desire and then click "OK" to print the document.

How to print using double column for source code?

Use the following command:

$enscript -2Gr -Pprinter_name filename

If you don't specify the printer, default printer is used. Default printer is specified by the environment variable PRINTER and it will be your nearest printer.

How to print a PS file?

Evince is the default program for postscript files. To print a file from evince, select print from file menu and select the appropriate printer. You can also use the the program gv for postscript files (it works for pdf files too). To print from gv, select print marked to print the current page or print all to print the whole document. In the print command dialog box, enter lpr -P<printer_name>. You can just enter lpr if you want to use the default printer.

How to print openoffice presentation handouts?

Click on View -> Handout page.
Then Format -> Slide Layout and click on the number of slides you want per page.
Then select File -> Print, click on options, and in the contents select Handouts (unselect Drawing).

How to change page orientation in OpenOffice?

Apparently changing between protrait and landscape in OpenOffice's print dialog box doesn't work. Use the following steps:

  • Click on the "Format" menu.
  • Select "Page..." from the popup menu.
  • Select the "Page" tab.
  • Change the page layout to the appropriate orientation (Portrait/Landscape).
  • Make sure the "Format" is set correctly (typically "Letter" unless you want to print on legal paper or some other special size paper).

How to delete my print jobs

  • First you need to know the id of your print job by using the command lpq -Plaser113(suppose you sent your print job to laser113)
  • To delete a print job with id 9999, you can do lprm -Plaser113 9999
  • If you are a lab consultant, you have the privilege to remove other people's print jobs in case they cause troubles. To remove all the print jobs on laser113, use the command lprm -Plaser113 -

Storage

How do I recover a deleted file?

A checkpoint copy of your home directory is made every day between 11am and 1pm. The past 3 days of checkpoint copies are kept, so if the file existed between 11am and 1pm in any of the past 3 days, you can restore the file yourself by following the steps below. If the file had been deleted more than 3 days ago, then follow this link to <a href='http://wiki.cec.mtu.edu/wiki/index.php/Backups'>the CEC's File Recovery Request page</a> with the name and location of the file you want restored, and a date of when the file existed. If it was created and deleted in the same day and you've already removed it from the trash, then there is no way the file can be restored.

To restore file from checkpoint copy:

  • Using the GUI interface
    1. Double click on your home directory folder that should be on your desktop.
    2. Press Ctrl+L or click on "file" and then select "Open Location...".
    3. Add /.ckpt to the location given.
    4. Double click on the folder most likely to contain the file that you want. Folders are labeled with the date and time (YYYY_MM_DD_hh.mm.ss_EDT).
    5. Navigate to where the file is stored and then just drag and drop it onto your desktop or whereever you want to restore it to.
  • Using a terminal window.
    1. Open a terminal window in your home directory.
    2. Change directory to the .ckpt directory (cd .ckpt).
    3. Change to the directory with the date that is most likely to have the file to be restored. Folders are labeled with the date and time (YYYY_MM_DD_hh.mm.ss_EDT).
    4. Navigate to where the file was stored and then copy it to your home directory, or whereever you want to restore it to.

Make sure you're copying it to your home directory and not elsewhere in the checkpoint directory.

How much storage space is available?

For majors the soft limit is 150 MB and hard limit is 220 MB. Similarly for non-majors soft limit is 40 MB and hard limit is 50 MB. Generally, you can exceed soft limit upto the hard limit for a grace period of one week after which the soft limit becomes the hard limit. There is no quota for grad students

How can I tell if I'm over quota?

You can use the command quota -v to view your disk usage. The output will be similar to the following:

Disk quotas for user yourid (uid 33232):

Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
colossus.csl.mtu.edu:/export/major
              4688  150000  220000             244       0       0        

The above output shows that the user yourid has used 4688 blocks (1000 blocks = 1MB), the soft limit is 150000 blocks (150 MB) and the hard limit is 220000 blocks (220 MB). Grace will be number of days you are allowed to be over soft limit. It is not applicable as long as you are under quota. Similarly, files are the total number of files owned by the current user. There is no quota on the number of files.

I don't have many files, but still my quota shows high usage. What is the problem?

The spaces might have been occupied by the hidden files and directories. Filenames begining with . are hidden. To view all files use the option -a with the ls command. You can also clear the browser cache, the object files (.o files), and executable files to save disk space. $ls -a Typical output of the command is as follows. Note that the names begining with . are hidden.

.                   
..                  .gconf                   .ppracer
.AbiSuite           .gconfd                  .qt
.Trash              .gnome2_private          .rhosts
(some other files)
.dmrc               .mozilla                 bin
.eclipse            .mplayer    	     Desktop           

You can use the du command to view the total space occupied by a directory. If you want to view the total disk space used by a directory named Desktop in your home directory,

$du -sh Desktop
208M    Desktop

The -s option is for summary and -h option is to print sizes in human readable format (e.g., 1K, 234M, 2G)

To see the amount of disk space in each of the hidden files and directories you can use the following command:

$du -sh .??*

How do I find large files to delete?

To make things easy, we've added a command to find the 10 largest files in your home directory. On any lab machine (or Wopr or Joshua), open a terminal window and type in the following command:

bigfiles

It will list the 10 largest files in the home directory of the logged in user. You can then delete files that you do not need using the rm command.

Another option is to use the following command which will report any files in your home directory that are over 20M. (If you do not find enough files to bring you under quota, you can find slightly smaller files by changing the "+20000k" to a slightly smaller number and run it again.)

find ~ -type f -size +20000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

What if I need more storage temporarily?

If you want more storage for temporary purpose, you can use the /tmp directory. Unlike the home directories, the /tmp directory is specific to a machine and not backed up.

How to Burn a CD?

The lab machines have k3b, a cd burning tool, installed. Type k3b in command line to open the k3b window. You can also open K3b in Gnome from Applications->Sound & Video->K3b.

How to use USB flash memory?

Plug in the USB into the box. An icon pops up at the desktop indicating the USB flash memory. The mount point is /mnt/usb. Remember to unmount after you are done. To unmount right click the usb icon and select unmount or use the command umount /mnt/usb at the shell prompt. Remember to close all the windows accessing the flash before unmount. If you are using the command line be sure to cd to another directory before issuing the umount command.

WWW

How do I make a personal web page?

See these articles:

[1] [2]

How do I clean up my web browser cache?

For firefox, Click on Edit, go to preferences. Then click Privacy icon. After that click on cache. Click clear to clean the current cache contents. It is recommended that you set only 1024 KB for cache.

Mozilla/Firefox will not allow me to open a new browser window?

After a crash, mozilla and firefox may have a lock file that didn't get cleaned up and prevent opening a new window. You have to delete the lock files if these programs complain during startup. These lock files are found in the .mozilla directory. To make things easy, we've added the following one-word command to find lock and .parentlock files that might be causing this problem:

fixlocks

The command finds any lock or .parentlock file and asks for each one whether you want to delete it or not.

*** Warning: It is recommended that you exit any other programs that are running before executing this command. The command finds all lock files in your home directory and eclipse also uses lock files. Deleting an eclipse lock file while eclipse is running could have unforseen consequences. ***

The above command will also help when Firefox tells you that you already have a browser window open when you don't and won't let you open a new one. This is caused by the presence of an internal file called .parentlock.

Firefox opens, but when I try to check my mail or surf to a new page, it closes?

Check your disk usage. Odds are that you are over your quota.

What can I do if my navigation buttons are grayed out on Firefox?

1) Close your currently running firefox.
2) Remove the sqlite files from your firefox profile:

    rm ~/.mozilla/firefox/*.default/*sqlite*

3) Find out which bookmark backup has your bookmarks:

    ls -l ~/.mozilla/firefox/*.default/bookmarkbackups

The filenames are dates of the form YYYY-MM-DD. Note the date of the newest, non-zero sized bookmark file.
4) Restart firefox.
5) Select "Organize Bookmarks" from the Bookmarks menu.
6) In the window that pops up, go to the "Import and Backup" -> "Restore" and choose the date of bookmark file you noted in step 3.
7) Click "Ok" on the dialog box that pops up.
8) Close the Bookmarks dialog box (it's titled "Library".)

Everything should be back to normal.

Other Software

How do I submit a program using "submit"?

Warning before you start: the filename of your files being submitted should not contain any whitespace characters. If you have spaces or tabs in your filenames, please take them out or change them to underscore characters before submitting.

  1. Log on to any machines in the csl domain.
    • This includes computers in Language Lab, Scifi Lab, Pizza Lab, and Forest Lab, and the CS Learning Center.
    • Also, you can ssh in to wopr.csl.mtu.edu or joshua.csl.mtu.edu from any Linux machine, or from a Windows machine using PuTTy.
  2. Change the current working directory to the one having the file to submit.
  3. Type submit on the command line and then press [Enter]. A list of course numbers will appear.
  4. Use the up and down arrow keys to highlight your course and then press [Enter]. Then a list of sections will appear.
  5. Choose your section by using the up and down arrow keys and pressing [Enter] when the appropriate one is highlighted.
    • Typically, this should be the same as the section on your registration form. (The section on you registration form is denoted by L## for labs, or R## for recitations.)
    • Some instructors may have students all submit under the same section, so if only one section pops up, then just select that one.
  6. Next, the screen will clear and a collection of 3 windows will appear.
    • Current Directory - Contains a list of files in the directory you were in when you typed the "submit" command.
    • Expected Files - If your instructor insists that you use specific file names, there may be a list of filenames that you are supposed to submit for the assignment.
    • Already Submitted - A list of the files you've already submitted for this assignment, along with the date and time they were submitted. (This feature allows you to verify that you've submitted your program.)
  7. Use the up and down arrow keys to highlight one of the files you want to submit and then press the space bar to mark it.
    • If you mark a file by mistake and don't want to send it, the space bar will unmark the highlighted file.
    • Repeat this step for any other files you need to submit.
  8. Once all the files you want to submit are selected, press the [Enter] key.
  9. Submit will display the list of selected files and ask for confirmation before sending. If the list is correct, enter "y" and then press [Enter].
  10. After the files have been submitted, it will take you back to the screen with the 3 windows where you can verify that the files are listed in the "Already Subitted" window.
  11. Press "q" to exit.
    • The terminal window will say "TERM environment variable not set." don't worry about it. Since your files were listed in the "Already Submitted" window, they were successfully submitted.

If you make changes to already submitted files, you can resubmit them. Just the newest copy of each submitted file is saved.

If you submitted a file that you later decide you didn't want to submit, there is no way to delete the file, but you could submit a blank text file with the same name. (This is probably why some instructors like students to archive the files to be submitted into a tarball

Due to changes in the e-mail system, you will not get a confirmation e-mail when you submit your files. Please pay attention to the "Already Submitted" window.

How do I create a tarball?

To create a simple tarball, just use the following command, substituting what you want for the tarball's <filename> and the files you want to include in it (<FILE1>, <FILE2>, ...)

tar -czf <filename>.tar.gz <FILE1> <FILE2> ...

To extract from a tarball that has the .tar.gz extension:

tar -xzf <filename>.tar.gz

For more tarball options, type in man tar on any Linux machine.

How to use vi?

Vi is the most common text editor on UNIX systems. Vi stands for "visual editor", it is pronounced "vee-eye". Enter the command vi at the shell prompt to run the program. You can also pass the name of the file you want to edit as an argument to vi. There are two main modes the command mode and the input mode. Press i to enter the input mode. From input mode press [ESC] to return back to command mode. Commands start with :. To save the current file, type in :wq [RETURN]. To exit without saving, enter :q! [RETURN]. The one installed in the lab machines is called vim (Vi improved). There is also a graphical version called gvim. For details read the man page of vi. There is also an interactive tutorial of vi. Type vimtutor at the shell prompt to run the tutorial. You can also visit http://www.vim.org/docs.php for various vi documents.

What is LaTeX and how do I use it?

LaTeX is a document typesetting program. To learn how to use it, you should check out one of the many tutorials available on the web, like http://www.cs.cornell.edu/info/Misc/LaTeX-Tutorial/LaTeX-Home.html or http://www.maths.tcd.ie/~dwilkins/LaTeXPrimer/ .

A variation called TeXmaker is installed on all of the lab machines and can be accessed through the Application menu in the Office submenu.

I am having weird problems with some software XYZ, what do I do?

First check whether you have exceeded your quota. It is always a good idea to leave some free space in your home directory. If that doesn't help contact csmaint@mtu.edu.

Eclipse won't open, what should I do?

Eclipse might complain about the lock files after a crash. The lock file is located at .metadata/.lock in the current workspace. Delete any files in that directory.

A quick way to accomplish this is to just type in "fixlocks" in a terminal window and it will search for any lock file in your home directory and ask if you want to remove it or not.

*** Warning: It is recommended that you exit any other programs that are running before executing this command. The command finds all lock files in your home directory and firefox also uses lock files. Deleting an firefox lock file while firefox is running could have unforseen consequences. ***

Also, eclipse doesn't work if you are over quota, so be sure to check your disk usage. (See How can I tell if I'm over quota? section above.)

Each time I open Eclipse, it says the workspace is in use. What can I do?

This is often caused by a lock file not being released. See Eclipse won't open, what should I do? above.

If that doesn't solve your problem, another cause of this is a compatibility problem between Eclipse and Gnome's Assistive Technology. Try disabling Gnome's Assistive Technology.

  1. Select "Preferences" from the System Menu.
  2. Select "Assistive Technologies".
  3. Uncheck the box marked "Enable assistive technologies".
  4. Click "Okay".

After you log out and log back in, you should no longer encounter the problem with Eclipse.

Simple System Administration

How to change your PATH enviroment variable?

$setenv PATH ${PATH}:/your/new/path 

If you want this change to reflect every time you login, include the above line in the file .cshrc in your home directory.

How to kill a program?

Find the process id of the program using the ps command. Then use the kill command to kill the required process.
For Linux, use $ps -ef to list the currently running processes.

For Solaris, use $ps -aux to list the currently running processes.

$kill -[signal] #processid 

Use the -9 signal only as a last resort.

How do I change my default shell?

The default shell is /bin/tcsh. If you want to change your default shell, use the command ypchsh. It will ask for your password and the shell you want to make default. You are advised not to do this unless you know what you are doing.

You can use other shells temporarily by typing the name of the shell. For example, if you want to use the bash shell, type bash at the command prompt. Use exit to return to the previous shell.

How do I convert an MS-DOS text file to a Unix/Linux text file?

Short answer: dos2unix

Long explanation:
Unix/Linux text file uses one character (0x0a, decimal number 10) to indicate a new line of text. On the other hand, MS-DOS text file uses two characters linefeed (LF, 0x0d) and carriage return (CR, 0x0a) to represent a new line of text.

If you use software (such as winftp) to transfer individual files from Windows to Unix, the chance is the software will convert the file format for you correctly.

If you use USB memory key to transfer files from Windows to Unix, the chance is the file format stays as DOS text file.

Some applications can recognize and preserve the style consistent automatically (such as vim on Fedora), so the users will not have trouble to work with a MS-DOS file.

But not all applications will do so. For example, Fortran compiler will have trouble to work with MS-DOS format file. Since Fortran is a semi-line oriented language, it can interpreter CR/LF as two lines, one ended by CR and the other by LF. Consequently, the continuation line is broken.

So it is better to make sure that you use the right format.

The utility dos2unix can convert a DOS text file to UNIX text file:

$dos2unix dos_file.txt newfile.txt

Also, the utiltity unix2dos can use used to convert a unix text file to MS-DOS text file.

For more info, type man dos2unix or man unix2dos.

To check if a file is MS-DOS on Fedora Linux, type file [filename],

[ruihong@mushroom ~]$ file ms_dos.txt

ms_dos.txt: ASCII text, with CRLF line terminators

To check if a file is MS-DOS on Solaris OS, type vi filename and you will see a ^M at the end of each line.

How to check the name of the computer you are using?

In the terminal window, enter the command hostname.

[ruihong@mushroom ~]$ hostname
mushroom

How to check the operating system of the computer you are using?

In the terminal window, enter the command uname -a.

For example, mushroom is running FC7.

[ruihong@mushroom ~]$ uname -a
Linux mushroom 2.6.23.15-80.fc7 #1 SMP Sun Feb 10 17:29:10 EST 2008
i686 i686 i386 GNU/Linux

Guardian is runing Solaris 8.

[ruihong@guardian ~]$ uname -a
SunOS guardian 5.8 Generic_108528-07 sun4u sparc SUNW,Ultra-2

Foreign Language Support

How do I get the lab machines to display my native language?

On the login screen, click on the word "Language" in the lower left corner. This will bring up a list of languages that our current version of Linux supports. There will be 2 column, one in the current language (default: English), and the other in the language itself. Select the desired language and click the "Change Language" button at the bottom. If your language is not listed, you can email csmaint@mtu.edu and we can see if it's available, but odds are that it isn't since we have loaded all available language at installation time.

How can I enter text in a different language than the current one?

SCIM is installed on all of the lab machines, but needs to be enabled per user.

Enabling SCIM

  1. Select the "System" menu, typically on taskbar along the top of your desktop.
  2. Select "Preferences".
  3. Select "Personal".
  4. Select "Input Method".
    • This will open the "IM Chooser" window, but it may take a while to do so. Be patient.
  5. If the "Enable input method feature" box is not checked, click on it to mark it.
    • Again, this takes a bit of time to respond, so be patient.
  6. Once the box is checked, you will need to log out and back in so the necessary files can be loaded.
    • If you have any files open, be sure to save your work and exit to prevent data loss.
  7. Click on the "Log Out" button on the "IM Chooser" window.
  8. Log back in.

Configuring SCIM Hotkeys

Switching back and forth on languages is much easier if you set up hotkeys. If you use several languages that don't use the standard english alphabet, you can program special key combinations for each language you want to use. Since most people will only use one additional language, I will take you through the steps to setup the ability to toggle on and off the SCIM program.

  1. Right click on the keyboard icon that is in the upper right corner of your desktop, on the taskbar.
  2. Select "SCIM Setup".
  3. On the left side of the "SCIM Input Method Setup" window that opened, select "Global Setup" under "FrontEnd".
  4. To the right, there is a frame labeled "Hotkeys". Click on the top button marked "...".
  5. In the window that just opened up, labeled "Select the trigger keys", click on the button marked "...".
  6. This opens another window asking you to press a key or key combination. A popular combination is ctrl+space.
    • Once you've pressed a key/combination, the one window will close and the key code and modifiers will be displayed on the "Select the trigger keys" window.
  7. Click on the "Add" button to save the combination.
  8. Click "Ok" to close the "Select the trigger keys" window.
  9. Click "Ok" to exit the "SCIM Input Method Setup".

Using SCIM

Once SCIM is enabled, a small keyboard icon will appear in the top right corner of your desktop on the taskbar. It might be to the left of the date/time. It's hard to make out, but it's a slightly darker gray rectangle on the light gray of the taskbar.

Starting Foreign Language Input

  1. Have the window/program that you want to input the foreign text into as the active window.
  2. If you configured the hotkeys, just press the key combination you programmed.
    • If you haven't configured the hotkeys...
      1. Click on the keyboard icon in the top right corner of your desktop on the taskbar.
      2. Select the desired language from the list that pops up.
        • Some languages have multiple dialects that can be selected from.
    • This will open small language toolbar down in the lower right corner of your desktop.

Changing Language

  1. Click on the language on the toolbar and this will bring up a list.
  2. Select the new language.

Going back to Session Language Input

  1. If you've configured the hotkeys, just press the key combination you programmed.
    • If you haven't configured the hotkeys...
      1. Click on the language on the toolbar and this will bring up a list.
      2. Select the "<language>/keyboard" option from the bottom of the list.

Since the SCIM program is "per-window", fortunately only the language toolbar for the currently active window is visible.

Android on Eclipse

Currently the Android plugins and SDK are installed in labs 112,112a,and 113a. To be able to use these tools, Eclipse must know where the path to the SDK is. To set the path, perform the following:

  1. Start Eclipse
      1. In Eclipse go to: Window -> Preferences
      2. In left hand window there will be Android. Click on this.
      3. Where it asks for the SDK path, copy and paste the following: /usr/local/android-sdk-linux_86

Debugging

How Do I Use the Debugger in Eclipse?

For a quick tutorial on using the debugger, visit the link below. https://drive.google.com/a/mtu.edu/#folders/0BzR3NgV0zTLYQnRJbGl0czBselk