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)
-
Go to this website: http://www.hawaii.edu/askus/778
-
Click on the link SSH 3.2.9 (5.35 MB)
-
Save the ssh329.exe file to your desktop.
-
Double-click on the ssh329.exe file on your desktop.
-
Click on the Run button.
-
Follow the instructions on the installation wizard.
-
This will download two icons on your desktop.
-
SSH Secure File Transfer Client (a yellow icon, which looks like a file) - used to transfer files between your computer and UHUNIX.
-
SSH Secure Shell Client (a gray icon, which looks like a computer terminal) - used to display the commandline interface for UHUNIX.
Step #1 for Mac: Download Fugu
-
Go to this website: http://rsug.itd.umich.edu/software/fugu/
-
Click on the "Download" link.
-
Dowload the lastest version, on the webpage listed as:
"Looking for the latest version? Download Fugu-1.2.1pre1.zip (1.5 MB)"
-
This will download a zip file with all the Fugu files.
-
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
-
Double click on the SSH Secure File Transfer Client (a yellow icon, which looks like a file).
-
Press the "Quick Connect" button (circled in red in the image below).
-
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.
-
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.
-
In the Enter Password window, enter the password for your UH username. Then press the "OK" button.
-
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.
Step #2 for Mac: Use Fugu to Connect to UHUNIX
-
After downloading the software, double-click on the Fugu Icon at the bottom your desktop.
-
If a window does NOT display, then click on SFTP menu, then Show SFTP Window.
-
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.
-
Enter your password, then press the Authenticate button.
Step #3 for PC: Use SSH to Transfer Files between Your Computer and UHUNIX
-
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.
-
Right click on the link aloha.c,
select "Save link as...", and save the file aloha.c on your desktop.
-
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.)
-
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.)
-
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
-
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.
-
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.
Step #4 for PC: Open the Commandline Interface Shell to UHUNIX
-
Click on the "New Terminal Window" button.
-
You will see a new widow open, which is the commandline interface shell to UHUNIX.
Step #4 for Mac: Open the Commandline Interface Shell to UHUNIX
-
Open the Terminal Window. How to Open a Terminal Window on the Mac
-
Click on the Macintosh HD.
-
Click on Applications.
-
Click on Utilities. Then, click on Terminal.
-
After clicking on Terminal, you should see the Terminal window.
-
On the commandline, enter this command to connect to your UH UNIX account: ssh username@uhunix.hawaii.edu
-
When you type, it will not display your password.
Step #5 for Linux: Compile and Run the C Program aloha.c
-
Compile the program by typing the gcc compiler, a space, and the C file name on the commandline:
gcc aloha.c
-
Press the "Enter" key.
-
Run the program by typing "./" ("dot slash", which is the current directory) followed by the executable "a.out" on the commandline:
./a.out
-
Press the "Enter" key.
-
You should see the output to the program.
-
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
-
Type "vi", a space, and the program name on the commandline:
vi aloha.c
-
Press the "Enter" key.
-
You will see the file contents in the vi command mode.
-
To switch to the insert mode, press the "i" key and press return.
You will see "-- INSERT --" at the bottom of the file.
-
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.
-
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.
-
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...
-
You are now back to the Linux commandline interface shell.
-
You can now compile and run the file again with the new output:
gcc aloha.c
./a.out
Click to validate the HTML code
Click to validate the CSS code