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 account directory (absolute path)
(Note the different slash directions)
cd \Users\«username»
(Separately type c: first if on a 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 a file named infile.txt†* java-introcs MyClass arg0 arg1 ... < infile.txt
(Over)write standard output to a file named outfile.txt†* java-introcs MyClass arg0 arg1 ... > outfile.txt
Pipe output of first command to input of second command «first command» | «second command»
(You can combine the three above things)†* E.g, java HelloWorld | java-introcs Sort > hi.txt
E.g, java-introcs Sort < input.txt > output.txt
Terminate program Control-C (this is not Copy!)
Copy text (to clipboard) Drag-select with 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
Optional: delete, move, copy file; make/remove dir del move copy mkdir rmdir rm mv cp mkdir rmdir
*: 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