Intro to Unix

Unix Guide

How to log into Rabbit

Your rabbit username is composed of the following [first letter of your first name][your last name]@rabbit.eng.miami.edu.

For example: Istvan von Fedak's rabbit username would be ivonfedak@rabbit.eng.miami.edu.

Mac users

Step 1: Open terminal. It should be in your applications folder.

Step 2: Type ssh -o HostKeyAlgorithms=+ssh-dss username@rabbit.eng.miami.edu in terminal and press enter. Make sure you type your rabbit user name instead of username.

Step 3: Type yes and press enter to connect to rabbit.

Step 4: Type in your password. Which should be a capital C followed by your C number.

Note: Repeat this process to sign in again next time.

Windows users

Step 1: Download putty at http://rabbit.eng.miami.edu/putty.exe.

Step 2: Open putty by clicking on the putty.exe file.

Step 3: Under Host Name (or IP address) type username@rabbit.eng.miami.edu. Make sure to type your rabbit user name instead of username.

Step 4: Make sure the SSH button is selected.

Step 5: Under Saved Sessions type rabbit.

Step 6: Click the Save button.

Step 7: Click rabbit under saved sessions to login.

Step 8: Type in your password which should be a capital C followed by your C number.



Note: Next time you sign in just click rabbit, under Saved Sessions, and it should sign you in.

If you have the Windows 10 anniversary update, you can download the Ubuntu core on windows. This would give you the option to sign in from the command line and allow you to copy and paste from the screen.

Useful Commands

Command Description
logout - log out of rabbit
passwd - changes your account password
ls - list files in the current directory
pwd - prints current working directory
touch file_name.cpp - creates a file named file_name.cpp
rm file_name.cpp - removes/deletes file named file_name.cpp
cat file_name.cpp - prints content of file_name.cpp to the terminal
mkdir folder_name - creates a directory named folder_name
a directory is the same as a folder so mkdir makes a folder
rmdir folder_name - if the directory is empty, it will remove/delete the directory named folder_name
cd folder_name - changes your current working directory to folder_name

Detailed Guide for Using Unix

CodeCademy offers a good tutorial on terminal commands. You can create an account and do the free lessons (you don't need to upgrade to pro!).

How to use Pico

Pico is a text editor for Unix.

Command Description
pico file_name.cpp - creates or opens a file named file_name.cpp
control + o - saves the file when both the control key and o key are pressed (o as in oscar)
make sure you have the correct file name and press enter
control + x - exits pico when both the control key and x key are pressed

If you try to exit pico without saving, it will ask you if you want to save the file. Press the y key, give the file a name and press enter to save it.

How to Compile

Compiling your code allows you to create an executable file that runs your program. The executable tells the computer how to execute your program.

Command Description
g++ file_name.cpp - tells the computer to compile the file file_name.cpp
a.out - to run your executable, type a.out in the terminal and press enter

Tip: make sure your file name ends with .cpp to tell the compiler it's a C plus plus file.

How to use Pine

Pine is a email service similar to gmail or outlook.

Command Description
pine - type pine in the terminal followed by enter will open pine
Q - quit pine
C - compose a message

Steps for sending a message with an attachment:

Step 1: To open pine type pine in the terminal and press enter.
Step 2: To compose a message press the C key.
Step 3: Move your cursor to "To :" and type the email address you want to send the message to.
Step 4: Move your cursor to "Attchmnt:" and press down both the control key and the t key.
Step 5: Search for the file you want to attach and press enter once the cursor highlights the file.
Step 6: Move your cursor to "Subject :" and type the email's subject.
Step 7: Move your cursor below "----- Message Text -----" and type the message text.
Step 8: To send the message press both the control key and the x key, followed by the y key.
Step 9: To quit pine press the q key, followed by the y key.

Creating a Hello World Program in Unix

Step 1: Make sure you are logged into rabbit. You should be greeted with the message "The New Rabbit."
Step 2: Type pico hello.cpp and press enter.
This will create a file named hello.cpp but you can name it whatever you want.
Step 3: Type the following program in pico:

#include <library.h>

int main(){

cout<<"Hello World"<<"\n" ;

// this is the same as using print("Hello World \n");

return 0;

}

Step 4: Save the program by pressing both the control key and the o key, and press enter.
Step 5: Quit pico by pressing both the control key and the x key.
Step 6: Compile the program by typing g++ hello.cpp and press enter.
Step 7: Type a.out in the terminal and press enter to run the program.

The compiler will give you errors if there are bugs in your code.