java-introcs StdOut
. If working, it will print four different data types. You can repeat with
StdIn
,
StdDraw
,
StdAudio
. If not working, ask course staff. Can be caused by moving/deleting files installed by installer. myVeryLongNameDir
, type
cd m
and then press Tab. The rest will be typed automatically for you. (If there are multiple possible completions, look at what is printed and/or press Tab some more.) Extra useful for filenames with spaces.
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
|
rm mv cp
|