| Useful Terminal/Unix Commands | |
|---|---|
| Command | Meaning |
./a.out |
execute most recently successfully compiled program |
cd |
move (change directory / folder) to your home folder |
cd ~/161 |
move to your 161 folder |
javac myFile.java |
compile Java file named myFile.java; builds myFile.class |
java myFile |
run java program Runs the main method of the myFIle class |
cp x y |
copy the contents of file x and name the copy y |
history |
get a list of commands you've used (!num repeats one) |
less b |
display file b page by page; arrows move up and down;
spacebar moves down; q quits |
logout |
disconnect from the machine |
lp x.java |
print file x.java 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.java |
rename file x.c to x.java (Java files end in .java) |
emacs x.java |
edit file x.java in text editor (not graphical from home; see below) |
rm junk |
remove file named junk; can't be recovered |
submitlog |
see a list of submissions you have made |
!! |
repeat previous command; using up arrow keys may be easier |
!prefix |
repeat most recent command that started with prefix |
Control-C stops the running program. Typing Control-D indicates end of input.
If you are connected to the Internet, you can use a program called ssh to connect to a lab machine. Please choose a machine other than cs, such as shaw, perlis, hopper, or one of the many others. The full address for hopper would be hopper.millersville.edu all lowercase and letters.
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 won't have syntax highlighting or working menus. But you can get by with very few commands. For simplicity, compile in the terminal rather than emacs. If you do this a lot, you should learn more emacs commands. 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 | |
|---|---|
| Command | Meaning |
emacs whatever.java |
start emacs editing whatever.java |
control-X control-S |
save the current buffer |
control-X control-C |
quit emacs |