Labs Help

Labs help

Do you need help with Lab Software, Hardware, Network, Access, Disk Quota?

Complete the lab help form and email it to cslabadmin@cs.iusb.edu or call 574-520-4439 or stop by the Lab Supervisor office in NS 203.

How to Debug C++ Programs in Linux

We have the gdb debugger installed, as well as Eclipse, which is an integrated IDE with a GUI similar to VisualStudio and contains a debugger.

gdb is the GNU debugger and can be run directly from the command line (terminal).

  1. Compile your program with debug information, and give it a name. -g is the option that allows the program to run in a debugger
    • g++ -g -o filename filename.cc
  2. Start debugging program. Include execution name of program on command line.
    • gdb filename
  3. Use break line number or break function name to add a break point.
  4. Type run to start running the program.
  5. Type clear to erase the breakpoint on the current line when the program stops at a break point.
  6. Type bt to see the backtrack of function calls when the execution stops at a break point.
  7. Type print expression to see the value of a variable or expression.
  8. Type step to execute one line of code or cont to continue the execution of the program until the next break point.
  9. Type stop to stop the execution of the program or quit to exit gdb altogether.

How to Create Linux Installation CD

A Linux installation CD or DVD can be created in any operating system.

First, acquire a CD/DVD image, which is usually a disk image file with the extension .iso, from any trusted distribution site. Here are some of the popular distributions:

  • Red Hat Enterprise Linux (RHEL) - The distribution currently in our labs, developed by Red Hat and targeted towards the commercial market.  RHEL is available only through a paid subscription service that provides access to software updates and varying levels of technical support, however IU Students have access to all releases of RHEL and can acquire a RHEL support community account through the following IU Knowledge Base webpage:
    http://kb.iu.edu/data/aqau.html or IU Site https://ftp.ussg.iu.edu/linux/
  • Fedora - A free collection of software, including an operating system based on the Linux kernel, developed by the community-supported Fedora Project and owned by Red Hat.  Fedora's main objective is not only to contain software distributed under a free and open source license, but also to be on the leading edge of such technologies, usually making upstream changes instead of applying fixes specifically for Fedora.  Think of Fedora as a "prototypical version" of the future of RHEL.
  • Ubuntu - A free distribution form Canonical, very popular and easy to use, with cloud and mobile support.
  • Community Enterprise Operating System (CentOS) - A Linux distribution that attempts to provide a free enterprise class computing platform which has 100% binary compatibility with its upstream source, Red Hat Enterprise Linux (RHEL).  One could easily think of CentOS as "The Free Version" of RHEL since CentOS developers use Red Hat's source code to create a final product very similar to RHEL.  CentOS possesses an extensive open source support community.
  • Linux Mint - A Debian and Ubuntu based distribution, popular, easy to use, with great support.

Then follow these steps to create the CD

  1.  Download the .iso file for the chosen distribution.
  2. Put a blank CD or DVD into the DVD drive.
  3. Click on the CD icon when it appears on the desktop.
  4. Under the Places menu select: Computer.
  5. Next select: File System.   Then select: iso
  6. Select the Linux distribution downloaded.
  7. Right click on the first disk image file.
  8. Select Write to Disk from the popup menu.
  9. When completed, right click on the CD icon and select Eject.
  10. Repeat above procedure for each CD.

  1. Download the .iso file for the chosen distribution.
  2. Put a blank CD or DVD into the DVD drive.
  3. Right-click on the .iso file.
  4. Select Open With:
  5. If Burn Disc Image appears, select it.
  6. Otherwise, select Windows Disk Image Burner.
  7. Follow the instruction in the chosen app.
  8. When completed, right click on the CD icon and select Eject.
  9. Repeat above procedure for each CD.

  1. Download the .iso file for the chosen distribution.
  2. Put a blank CD or DVD into the DVD drive.
  3. From Applications – Utilities, open Disk Utility.
  4. From the File menu, choose Open Disk Image
  5. Select the .iso file, and then click Burn.
  6. When completed, right click on the CD icon and select Eject.
  7. Repeat above procedure for each CD.

How to Manage your Disk Quotas in Linux Labs

Students are provided with accounts Linux machines. Linux home directories have disk quotas that limit the total disk usage. The soft disk quota is 1.8 Gb. You may exceed it for up to seven days. The hard limit is 2 Gb. You may not exceed it. If you do exceed either limit you will be unable to login normally. You will need to login using text console mode and remove some files to lower your disk quota. If you have special needs, please contact the lab manager.

  1. Open a terminal or console.
  2. Use the command quota or quota -v to see how much space you have and how much you have exceeded it.
  3. Use this command regularly to see how close you are from filling your quota.
  4. Use the suggestions below to free space in your account.

  • Find Your Disk Usage. Execute the command "cd; du -s .[A-z]* * | sort -n" to show how much disk space each file and directory is using. With this information, you can look for things to remove.
  • Remove "core" Files. These files are created when a process exits abnormally and can be safely deleted. Run "find ~/. -name core" to find all core files in your home directory, and run "find ~/. -name core -exec rm {} \;" to remove them.
  • Reduce the Firefox Cache.  1. Start Firefox.  2. Select "Preferences" from the "Edit" menu. 3. Click on "Advanced". 4. Click on "Network". 5. Under Cached Web Content click on "Clear Now". You can also do the same with Offline Web Content and User Data 6. You can also reduce the amount of space used for cache by checking the box Override automatic cache management and selecting how much space you want to allow for it.
  • Remove Backup Files. If you edit a file named foo.c, emacs will create a backup copy named foo.c~. You can find these files by running "cd; find . -name \*~" and you can remove them with "cd; find . -name \*~ -exec rm {} \;".
  • Remove Orphan Files. These files are left when a process is killed unexpectedly. To find them run "cd; find . -name #\*#" To remove them run "cd; find . -name #\*# -exec rm {} \;".
  • Compress Files. If you have a file named foo, "gzip foo" will compress the file and replace it with one named "foo.gz". Use "gzip -d foo.gz" to uncompress it and "zcat foo.gz" to view it.

How to Use USB and other External Drives in Linux

Check for Linux compatibility. Many are not supported by Linux.

In most cases, plugging in the USB drive or CD will cause it to be automatically mounted. The icon will appear on the desktop in that case.

The mount point is most likely goind to be /MEDIA/usb or /MEDIA/CD or some other similar name.

  • Insert drive before mounting.
  • Mount the usb drive at /mnt/memdrive using the following command
    • mount /mnt/memdrive
  • Now you can use regular Linux commands to copy and manipulate files from /mnt/memdrive
  • You need to unmount before removing drive. The following commands unmounts the usb or CD drive.
    • umount /mnt/memdrive
    • unmount /MEDIA/CD
  • Unmounting the drive and ejecting it.
    • eject /MEDIA/CD

How to Create Personal Web Site in Linux

  1. Set the permission of your home directory to world executable.The first command moves you to the root of your home directory. The second adds executable to the permission for others.  Don't forget the ~
        Enter: cd
        Enter: chmod o+x ~
  2. Add a directory to hold your web pages.
        Enter: mkdir public_html
  3. Set the permission of your web page directory to world executable.
        Enter: chmod o+x public_html
  4. Copy your web pages to your public_html directory.
        If they are on a floppy disk you can use the mcopy command to copy them to Linux.
  5. Your home page file must be named: index.html
  6. All files in your public_html directory must be world readable.
        First move to your public_html directory then
        Enter: chmod o+r *
  7. Test your new web site.  First start firefox, then
       Enter: www.cs.iusb.edu/~your_login_name

How to Print in the Labs

Use the lpr command followed by the printer name and the file to print.  The printers available in our labs are cslp1, cslp2, and cslp3. Currently printing can only be done from one of the lab workstations, so cs01 through cs06 have no access to the printers. The use of printers is restricted the following way:

cslp1 - workstations in NS 207A
cslp2 - workstations in NS 207B
cslp3 - workstations in NS 209

The print command can be used the following way, where the option –P specifies the printer - see above:
lpr -Pcslp1 your-filename-to-print

To cancel printing, enter lpq and the printer name with the –P option. This gives you the job’s queue number. Then enter lprm, the printer name with the –P option, and the job number to remove.

 
Example.  Enter lpq & printer at prompt:  lpq  -Pcslp1
Output show jobs:  Rand   Owner   Job    Files   Total Size 
 1st bgriff    4 cs.cpp 408 bytes
 
To remove job #4 enter:   lprm –Pcslp1 4

 

No special procedures required.  However, when the Windows "Print" dialog box appears check that cslp1, 2, or 3 is the default printer, depending on the lab where you are.  If it is not, enter "cslp1", 2, or 3 in the "Printer Name" box.

How to Develop Programs as Teams and/or Control Source Code Versions (Git and GitHub)

Indiana University South Bend social media channels

Indiana University South Bend

1700 Mishawaka Ave
South Bend, IN 46615
Phone: 574-520-4872