| 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 |
c++ -Wall -g b.cpp |
compile C++ file named b.cpp; executable is ./a.out |
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.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) |
emacs x.cpp |
edit file x.cpp 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.