Tips and Tricks

Command Prompt Cheatsheet

download osx cheatsheet wallpaper

  • Tab completion. If you are trying to move into a directory named 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.
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 javac
(For old installer javac
Run program MyClass java MyClass arg0 arg1 ...
Read standard input from a file named infile.txt java MyClass arg0 arg1 ... < infile.txt
(Over)write standard output to a file named outfile.txt java 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 Sort > hi.txt
E.g, java Sort < input.txt > output.txt
Terminate program Control-C
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

Unzipping Files on Windows

  1. Locate the zipped folder that you want to unzip (extract) files or folders from.
  2. Do one of the following:
    • To unzip a single file or folder, open the zipped folder, then drag the file or folder from the zipped folder to a new location.
    • To unzip all the contents of the zipped folder, press and hold (or right-click) the folder, select Extract All, and then follow the instructions.

PYTHON: Installing, Setting the PATH

To determine your version of Python, open the Terminal application, type the following, and press Return:

python -V

This command will report the version of Python, e.g.:

Python 2.7.3

Whether you use Mac, Windows, or Linux, we recommend installing Python 3.
We use the Anaconda distribution of Python 3.6. CLICK HERE DOWNLOAD ANACONDA INSTALLER.

When you run the installer, be sure to check the box to add Python to the PATH under advanced settings. (It will have a large amount of red text saying this is not recommended. Ignore that, check the box, and continue).

To manually add Python to the PATH in Windows:

  • In the Windows menu, search for "advanced system settings" and select View advanced system settings.
  • In the window that appears, click Environment Variables… near the bottom right.
  • In the next window, find and select the user variable named Path and click Edit… to change its value. The value for this variable is a semi-colon-delimited list of file locations.
  • Scroll to the end of the value, add a semi-colon, and then add the location of python.exe (where you installed it).
  • Click OK to save this change.
  • If you do not have a user variable named Path, click the New… button.
  • Add a variable named Path and make its value the location of python.exe.
  • Confirm addition to path: Open a new command prompt and re-run the original command:
    python to confirm that Python is installed and added to your path.

Connecting to a network drive ("H drive, I drive, J drive")

Windows or VMWare Virtual Lab (mapping a network drive)
If you are on a campus computer, or logged on to VMWare Horizon VLAB, your H: Drive should be automatically mapped and will be found under COMPUTER in the File Explorer. If it is not you will need to add it:

  1. Click on the "Start Menu."
  2. Right click on "Computer."
  3. Click on "Map Network Drive."
  4. Select a Drive Letter that's not already in use from the dropdown menu.
  5. Type the address of the server and the share in "Folder". The format is \\server\share, so to access the shared folder "temp" on the server "fileserver1", you would use \\fileserver1\temp.
    • Faculty: \\fileserver1\username
      • \\fileserver1\jdoe
    • Student: \\\students\username
      • \\\students\j_doe
  6. Check "Reconnect at logon" to automatically reconnect.
  7. You can find the mapped drive under "Computer"

Command DOS prompt (drive must be mapped, see instructions above)

  1. Open a Command Prompt window by clicking Start and typing "command" or "cmd" in the search box then click the Command Prompt icon in results.
  2. Type "H:" at the prompt to access your network drive.
  3. Typing "dir" will list a directory's contents

Mac (mounting a volume)

  1. Open Finder
  2. Click "Go."
  3. Click "Connect to Server."
  4. Type "smb://" followed by the server address.
    *Student: smb://
    *Faculty: smb://fileserver1/username
  5. It may ask for your username and password. If it does, type in your Colorado College username and password and click continue.
  6. Once you are connected to the network drive we can set up automatic connections upon logging into the Mac:
    • Open System Preferences and click on "Users & Groups"
    • Select your user name from the list and then click the "Login Items" tab
    • Drag & drop a mounted network drive into the login items list
    • Optional: check the "Hide" box to keep the drives window from opening on each login and boot

Mac Terminal (H drive volume must be mounted via Mac instructions above)

  1. Open Terminal Window
  2. Type "cd /Volumes/username"
  3. Typing "ls" will list directory contents.
Report an issue - Last updated: 12/17/2020