Software Instructions:
How to Edit, Compile, and Run C/C++ Programs on UH Information Technology Services (ITS) RedHat Linux 7


Step #1 for PC: Download Secure Shell (SSH)

  1. Go to this website: http://www.hawaii.edu/askus/778
  2. Click on the link SSH 3.2.9 (5.35 MB)
  3. Save the ssh329.exe file to your desktop.
  4. Double-click on the ssh329.exe file on your desktop.
  5. Click on the Run button.
  6. Follow the instructions on the installation wizard.
  7. This will download two icons on your desktop.
  8. SSH Secure File Transfer Client (a yellow icon, which looks like a file) - used to transfer files between your computer and UHUNIX.
    SSH Secure File Transfer Client
  9. SSH Secure Shell Client (a gray icon, which looks like a computer terminal) - used to display the commandline interface for UHUNIX.
    SSH Secure Shell Client

Step #1 for Mac: Download Fugu

  1. Go to this website: http://rsug.itd.umich.edu/software/fugu/
  2. Click on the "Download" link.
  3. Dowload the lastest version, on the webpage listed as: "Looking for the latest version? Download Fugu-1.2.1pre1.zip (1.5 MB)"
  4. This will download a zip file with all the Fugu files.
  5. For those students who have a Mac and are having issues with Fugu, another recommended file transfer protocol (FTP) application is FileZilla. Here is the website: https://filezilla-project.org/

Step #2 for PC: Use SSH to Connect to UHUNIX

  1. Double click on the SSH Secure File Transfer Client (a yellow icon, which looks like a file).
    SSH Secure File Transfer Client
  2. Press the "Quick Connect" button (circled in red in the image below).
    SSH Secure File Transfer Client widow
  3. Because the Default Settings have not been set yet, you will get the File Open Error error message. Do NOT panic. This is normal. Click the "OK" button.
    File Open Error widow
  4. Type the following values in the Connect to Remote Host window:
    Host Name: uhunix.hawaii.edu
    User Name: username
    (The username is your UH username. This is the same username as you used to register for classes on the myUH portal. Your username is the part of your UH email address BEFORE the at-sign (@). For example, if your UH email name is suzuki@hawaii.edu, then your UH username is suzuki.)
    Port Number: 22
    Authentication Method: Password
    Press the "Connect" button.
    Connect to Remote Host widow
  5. In the Enter Password window, enter the password for your UH username. Then press the "OK" button.
    Enter Passwordclick widow
  6. In order to transmit your password and other information over the Internet securely, SSH mathematically encrypts the information using keys which are long combinations of letters as shown below. Press the "Yes" button.
    Host Identification widow

Step #2 for Mac: Use Fugu to Connect to UHUNIX

  1. After downloading the software, double-click on the Fugu Icon at the bottom your desktop.
    Fugu icon
  2. If a window does NOT display, then click on SFTP menu, then Show SFTP Window.
  3. Connect to: uhunix.hawaii.edu
    Username: username
    (The username is your UH username. This is the same username as you used to register for classes on the myUH portal. Your username is the part of your UH email address BEFORE the at-sign (@). For example, if your UH email name is suzuki@hawaii.edu, then your UH username is suzuki.)
    You do not have to type values for Port or Directory. You can leave these fields blank.
    Click the "Connect" button.
    Login window
  4. Enter your password, then press the Authenticate button.
    Password icon

Step #3 for PC: Use SSH to Transfer Files between Your Computer and UHUNIX

  1. The left side of the SSH window shows the files and folders on your desktop, which is circled in red in the image below.
    The right side of the SSH window shows the folders and files on your UH UNIX account, which is circled in green in the image below.
    SSH Secure File Transfer window
  2. Right click on the link aloha.c, select "Save link as...", and save the file aloha.c on your desktop.
  3. To see new files in SSH, you may need to press the Refresh button (two arrows) at the top of the window. (The buttons are circled in red in the image below.)
    refresh button
  4. Click on the aloha.c file on the left window of SSH and drag it to the right window of SSH. (In the image below, the aloha.c file is circled in red. The thick, red arrow points is directing you to click on the aloha.c file, and drag the file to the SSH right window.)
    file transfer
  5. To move files from UHUNIX to your computer, drag the file from the right window to the left window.

Step #4 for Mac: Use Fugu to Transfer Files between Your Computer and UHUNIX

  1. The left window (circled in red in the image below) in Fugu shows the files and folders on your computer.
    The right window (circled in green in the image below) in Fugu shows the files and folders on your UH UNIX account.
    Fugu window
  2. To copy files from your desktop to your UH UNIX account, drag the file from the left window to the right window. And vice-versa.
    Fugu window

Step #4 for PC: Open the Commandline Interface Shell to UHUNIX

  1. Click on the "New Terminal Window" button.

    New Terminal Window button
  2. You will see a new widow open, which is the commandline interface shell to UHUNIX.

    Terminal Window

Step #4 for Mac: Open the Commandline Interface Shell to UHUNIX

  1. Open the Terminal Window. How to Open a Terminal Window on the Mac
  2. Click on the Macintosh HD.
    Macintosh HD
  3. Click on Applications.
    Applications
  4. Click on Utilities. Then, click on Terminal.
    Utilities
  5. After clicking on Terminal, you should see the Terminal window.
    Terminal Window
  6. On the commandline, enter this command to connect to your UH UNIX account: ssh username@uhunix.hawaii.edu
  7. When you type, it will not display your password.
    ssh login

Step #5 for Linux: Compile and Run the C Program aloha.c

  1. Compile the program by typing the gcc compiler, a space, and the C file name on the commandline:
    gcc aloha.c
    gcc command
  2. Press the "Enter" key.
  3. Run the program by typing "./" ("dot slash", which is the current directory) followed by the executable "a.out" on the commandline:
    ./a.out
    executable
  4. Press the "Enter" key.
  5. You should see the output to the program.
    execute command
  6. Note: If you want to compile C++ programs, type the g++ compiler, a space, and the C++ file name on the commandline:
    g++ filename.cpp

Step #6 for Linux: Use vi to Edit the C Program aloha.c

  1. Type "vi", a space, and the program name on the commandline:
    vi aloha.c
    vi command
  2. Press the "Enter" key.
  3. You will see the file contents in the vi command mode.
    vi command mode
  4. To switch to the insert mode, press the "i" key and press return. You will see "-- INSERT --" at the bottom of the file.
    insert mode
  5. You can now type text into the file. Use the arrow keys to move the cursor down several lines. Type in one line of code as you wish. In this example, an Alabama surfer typed a Southern greetings.
    insert mode with another line of code
  6. Switch back to command mode by pressing the "Esc" key. In the command mode, you will no longer see the "-- INSERT --" text at the bottom.
    command mode
  7. In command mode, write (save) and quit (exit vi) by typing ":wq" and pressing the "Enter" key.
    Actually, you should never quit! Except when using vi...
    write and quit
  8. You are now back to the Linux commandline interface shell.
    back to Linux shell
  9. You can now compile and run the file again with the new output:
    gcc aloha.c
    ./a.out
    compile and run the file again


Click to validate the HTML code

Click to validate the CSS code