This guide will teach the following: 1. How to connect to a remote linux server using Windows 2. How to connect to a remote linux server using a MAC/linux 3. Some common linux commands 4. Emacs ------------------------------------------------------- 1. How to connect to a remote linux server using Windows ------------------------------------------------------- In this example we will be connecting to the remote server called sampson.washcoll.edu. To do this, we first need a username and password to the server. For the purposes of this document, I will simply write username and password when these are required. Steps to connect to sampson: 1. Download putty (google for ssh putty) 2. Select SSH for connection type 3. Type sampson.washcoll.edu as the Hostname 4. Click Open 5. Type username when prompted 6. Type password when prompted 7. You are connected to the remote server called sampson ------------------------------------------------------- 2. How to connect to a remote linux server using a MAC/linux ------------------------------------------------------- In this example we will be connecting to the remote server called sampson.washcoll.edu. To do this, we first need a username and password to the server. For the purposes of this document, I will simply write username and password when these are required. 1. Open a terminal (or the terminal program in MAC) 2. Type ssh username@sampson.washcoll.edu 3. Type password when prompted 4. You are connected to the remote server called sampson. ------------------------------------------------------- 3. Some common linux commands ------------------------------------------------------- In these commands, I will often list them with tic marks (') around the command. These tics are not meant to be typed but rather show valid commands on the linux command line. 'ls' is a common command to list the files in a directory. It is often typed as 'ls -al' to give a more thorough listing of the files 'mkdir' is the make directory command. For example, to create a directory called csi201, you would type 'mkdir csi201' 'cd' is the command to change directory. For example, to change into the csi201 directory, you would type 'cd csi201' 'cp' is used to copy a file into another file. For example, to copy hw1.cpp into a file called hw2.cpp you would type 'cp hw1.cpp hw2.cpp' 'emacs' is a common program on linux systems. To run emacs you often simply type 'emacs' on the command line. You might also type 'emacs file.cpp' to open or create a file called file.cpp. For more information, see the emacs portion of this tutorial. 'g++' is the compiler command. To compile a C++ program in the file file.cpp you would type 'g++ file.cpp -o file.exe' file.exe is the executable output of the C++ program. To execute a local file or program (like the compiled program file.exe from the previous command), you would type './file.exe' 'cat' will output the file to the screen. So, for example, 'cat file.cpp' will output the contents of file.cpp to the console. 'enscript' is a common program to print files with more formatting. For example, the command 'enscript -2Gr -Pd103 hw1.txt' instructs the server to print the file hw1.txt to the printer d103 using two columns (-2) in landscape mode (-r) with a header box (-G). 'script' is a common program to demonstrate what is being done on the linux command line. In specific, it is often used in Dr. Ramsey's CSI 201 course to demonstrate student program executions and correctness. To run a script and save the result in a file called script.txt, you would type 'script script.txt' To actually write the session to the file script.txt you must end the session with the exit command. An example of the commands that might be typed after script follow. script hw1.txt cat hw1.cpp g++ hw1.cpp -o hw1.exe ./hw1.exe ./hw1.exe ./hw1.exe exit enscript -Pd103 -2Gr hw1.txt 'time' is a program commonly used to test the timing of executable files. To use this command on a program like ./file.exe that you have created, you simply type 'time ./file.exe' This will output a real, user and sys time. Real time is the actual time from program start to program finish, but may often include a large amount of user input type. user time is often the value that is of most interest and demonstrates the amount of processing time for this program. Hitting ctrl and c simultaneously (ctrl-c) will attempt to interrupt (and halt) the currently running program. This is useful for run-away loops and other erroneous 'run-away' programs. ------------------------------------------------------- 4. Emacs ------------------------------------------------------- In this tutorial, I will list some common emacs commands. Often commands are written as ctrl-x or alt-x. This means press these keys at the same time and then let them go. Emacs commands: ctrl-x ctrl-c Quit Emacs ctrl-x ctrl-s Save Current File as given file name ctrl-x ctrl-f Open a new file (type the new filename) ctrl-x ctrl-w Save Current As (type the new filename) alt-x compile Open up a compile line/window in emacs ctrl-f Go forward one space ctrl-b Go back one space ctrl-e Go to end of line ctrl-a Go to start of line ctrl-n Go to next line ctrl-p Go to previous line ctrl-v Go down one page alt-v Go up one page ctrl-k Delete to end of line from cursor (repeat to delete multiple lines) ctrl-y Paste lines cut using ctrl-k ctrl-x b Switch to another emacs buffer ctrl-x k Kill current buffer