Good to know:
Action Windows Command Prompt Mac OS X Terminal
What is my current directory? cd pwd
Show contents of current directory dir ls
Move to subdirectory "sub" (relative path) cd sub
Move to parent directory cd ..
Move to your user directory
(absolute path) (Note different slashes!)
cd \Users\username
(Use c: first if on different drive)
cd /Users/username
View the contents of file "filename"* more filename
Compile MyClass.java w/ Std libraries javac-introcs MyClass.java
Run program MyClass with Std libraries java-introcs MyClass arg0 arg1 ...
Redirect standard input from file "infile"†* java-introcs MyClass arg0 arg1 ... < infile
Redirect standard output to file "outfile"†* java-introcs MyClass arg0 arg1 ... > outfile
Pipe: make output of command1 the input to command2 command1 | command2
Examples of combining the above†* java HelloWorld | java-introcs Sort > hi.txt
java-introcs Sort < input.txt > output.txt
Terminate program control-C
Copy text (to clipboard) Drag-select w/mouse, then Enter Drag-select with mouse, then command-c
Paste text (at current cursor) Right-click in terminal/command prompt window
End of typed-in standard input (EOF) control-Z on own line then Enter control-D
For extra fun: delete, move, copy file
make dir, remove dir, find text in file, append
del move copy
mkdir rmdir find
rm mv cp
mkdir rmdir grep >>
*: commands for reading/writing assume file is exactly in your current directory, else add relative/absolute path
: the .java and .class files must reside in your current directory