Good to know:
To do this: Type on PC Command Prompt Type on Mac 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
(For old installer javac MyClass.java)
Run program MyClass with Std libraries java-introcs MyClass arg0 arg1 ...
(For old installer java MyClass arg0 arg1 ...)
Read standard input from file "infile"†* java-introcs MyClass arg0 arg1 ... < infile
(Over)write standard output to file "outfile"†* java-introcs MyClass arg0 arg1 ... > outfile
Pipe: make output of 1st cmd input of 2nd first command | second command
Examples of combining the above†* java HelloWorld | java-introcs Sort > hi.txt
java-introcs Sort < input.txt > output.txt
Terminate program Control-C (this is not Copy!)
Copy text (to clipboard) Drag-select w/mouse, then Enter Drag-select with mouse
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 have to be exactly in your current directory