Useful Terminal/Unix Commands
CommandMeaning
./a.out execute most recently successfully compiled program
cd move (change directory / folder) to your home folder
cd ~/cs362 move to your cs362 folder
c++ -Wall -g *.cpp compile all C++ files ending in .cpp in this directory
executable is ./a.out
cp x y copy the contents of file x and name the copy y
cp -r dirName . copy the directory dirName to the current directory
keeping the name of the original (the dot means use same name)
emacs x.cpp edit file x.cpp in text editor (not graphical from home; see below)
history get a list of commands you've used (!num repeats one)
javac *.java compile all the Java classes in this directory
java MainClass execute the Java class named MainClass (don't use .class)
use javac to create the class files
less b display file b page by page; arrows move up and down;
spacebar moves down; q quits
man command shows the manual entry (help) of the command
logout disconnect from the machine
lp x.cpp print file x.cpp to printer; only plain text files
ls list the files in the current directory
ls -l list files, last time changed, size, and permissions
mv x.c x.cpp rename file x.c to x.cpp (C++ files end in .cpp)
rm junk remove file named junk; can't be recovered

Control-c stops the running program. Typing Control-d indicates end of input.

Connecting From Outside the Lab

Many people prefer to work on their outside lab assignments from home rather than in the lab. You should also check your email for important class messages. You can check your email through Squirrel Mail (https://cs.millersville.edu/webmail/src/login.php) Use your cs userid and password.

If you are connected to the Internet, you can use a program called ssh. If you don't have one of those programs, check out MUCS Secure Connections (http://cs.millersville.edu/security). You can use that to connect to a lab machine such as shaw, perlis, hopper, or one of the many others. The full address for hopper would be hopper.cs.millersville.edu all lowercase and letters. Note the cs between the machine name and the university's domain name. Use logout when you are done.

When you use ssh, you will have a terminal, not graphical, connection as if you were using the terminal application in the lab. Use the arrow keys in the terminal to repeat commands. The emacs in a terminal is not graphical and may not have syntax highlighting or working menus. But you can get by with very few commands. For simplicity at the beginning of the course, you may compile and run in the terminal rather than emacs. Using two terminal windows makes that easy. You will learn more emacs commands as the course continues, but this is a minimal set that is enough to get work done.
Minimal Set of Emacs Commands
Use arrow keys - not mouse - to move around
CommandMeaning
emacs whatever.cpp start emacs editing whatever.cpp
control-x control-s save the current buffer
control-x control-c quit emacs