For many of you, this is the first time [or nearly so] that you are actually typing in "real" commands to the computer. Usually, you boot your machine, wait for the windowing interface to appear, then use the mouse [and some typed commands or keypresses] to accomplish your tasks in the windows which get started by clicking on things. For this class, however, much of that familiarity will RAPIDLY disappear.
To help you with navigating the command window [Windows] or terminal window [Mac/UNIX/Linux], here is a handly table of some basic commands with explanations of what they mean and what they do. While it is most definitely not exhaustive, and not even really comprehensive, it will at least provide you with a reference of basic "stuff" to get you going.
You start the Mac/Linux/UNIX command line the finder, the launchpad, or the spotlight. From the Finder icon in the dock, click "Applications" in the favorites list, then find the "Utilities" folder and click to open it; locate "Terminal" and double-click the icon to open the program.
From the Launchpad, click the Launchpad icon to open the screen of application programs; find the "Other" icon and click to open it. The Mac displays a set of utility programs. Locate the icon for the Terminal program and click it. As an alternative, click the text area next to the magnifying glass icon in Launchpad and type "terminal". Launchpad locates and displays the Terminal icon -- a handy time-saver if your MacBook has many programs. Click the icon to open the program.
From Spotlight, click the "Spotlight" magnifying glass icon. In the text field that opens, type "terminal". Spotlight displays a list of matches for the word "terminal" including the program. Click the entry for Terminal to open it.
Once the terminal window is open, you can use the commands from the following table. Remember that in the following descriptions, the words "directory" and "folder" are treated as synonymous.
| FREQUENTLY USED COMMANDS | ||
| Item | Command | Meaning/Action Performed [possible "switches"] |
|---|---|---|
| 1 | pwd | Output which directory is the current directory |
| 2 | cd <directory or path> | Change directory to that specified |
| 3 | ls | List the contents of the current directory |
| 4 | ls <directory or path> | List the contents of the named directory |
| 5 | mkdir <directory or path> | Make a new directory or subdirectory |
| 6 | rmdir <directory or path> | Remove a directory or subdirectory |
| 7 | rm <file or directory> | Delete a file |
| 8 | cp <source file> <target file> | Copy one file to another |
| 9 | more <file> | List out file contents, pause for each screen-full |
| 10 | mv <source file> <target file> | List out file contents, pause for each screen-full |
| 11 | cat <file> | List out file contents, but without pausing |
| 12 | man <shell> | List out the commands available for the shell |
| 13 | man <command> | Get the help page for <command> |
| OTHER INTERESTING COMMANDS | ||
| 14 | alias | lets you give your own name to a command or sequence of commands |
| 15 | chmod | Sets the file permissions flags on a file or folder |
| 16 | chown | change the owner and group owner of a file |
| 17 | curl | tool to retrieve information and files from URLs or internet addresses |
| 18 | df | shows the size, used space, and available space on the mounted filesystems |
| 19 | curl | tool to retrieve information and files from Uniform Resource Locators (URLs) or internet addresses |
| 20 | diff or sdiff | compares two text files and shows the differences between them |
| 21 | echo | echoes a string of text to the terminal window |
| 22 | exit or cntl+d | close a terminal window or log you out of a remote access session |
| 23 | find | track down files that you know exist if you can’t remember where you put them |
| 24 | free | gives you a summary of the memory usage with your computer |
| 25 | grep | searches for lines which contain a search pattern |
| 26 | head [or tail] | gives you a listing of the first [or last] 10 lines of a file |
| 27 | history | lists the commands you have previously issued on the command line |
| 28 | ping | verify that you have network connectivity with another network device |
| 29 | ps | lists the running processes |
| 30 | tar | create an archive file [like a zip file] |
| 31 | top | shows you a real-time display of computer status |
| 32 | uname | obtain some system information |
| 33 | whoami | find out who you are logged in as |
You start the windows command line by either finding it in the programs list [by clicking through the following process: Start button -> All Programs -> Accessories -> Command Prompt] or by using the "Run Box" [by clicking through the following process: Start button -> Search box -> type "cmd" and press the ENTER key]. You'll see the command window appear.
Once the command window is open, you can use the commands from the following table. Remember that in the following descriptions, the words "directory" and "folder" are treated as synonymous.
| FREQUENTLY USED COMMANDS | ||
| Item | Command | Meaning/Action Performed [possible "switches"] |
|---|---|---|
| 1 | cd or chdir | Output which directory is the current directory |
| 2 | cd or chdir <directory or path> | Change directory to that specified |
| 3 | dir | List the contents of the current directory |
| 4 | dir <directory or path> | List the contents of the named directory |
| 5 | md or mkdir <directory or path> | Make a new directory or subdirectory |
| 6 | rd or rmdir <directory or path> | Remove a directory or subdirectory |
| 7 | del <file or directory> | Delete a file |
| 8 | erase <file or directory> | Delete a file |
| 9 | copy <source file> <target file> | Copy one file to another |
| 10 | more <file> | List out file contents, pause for each screen-full |
| 11 | type <file> | List out file contents, but without pausing |
| 12 | help | List out the commands available |
| 13 | ren or rename | Renames a file or files |
| 14 | <command> /? | Get the help page for <command> |
| OTHER INTERESTING COMMANDS | ||
| 15 | attrib | Displays or changes file attributes. |
| 16 | chkdsk | Checks a disk and displays a status report. |
| 17 | cls | Clears the screen. |
| 18 | cmd | Starts a new instance of the Windows command interpreter. |
| 19 | color | Sets the default console foreground and background colors. |
| 20 | comp | Compares the contents of two files or sets of files. |
| 21 | date | Displays or sets the date. |
| 22 | echo | Displays messages, or turns command echoing on or off. |
| 23 | exit | Quits the CMD.EXE program (command interpreter). |
| 24 | fc | Compares two files or sets of files, and displays the differences between them. |
| 25 | find | Searches for a text string in a file or files. |
| 26 | findstr | Searches for strings in files. |
| 27 | mklink | Creates Symbolic Links and Hard Links |
| 28 | move | Moves one or more files from one directory to another directory. |
| 29 | path | Displays or sets a search path for executable files. |
| 30 | popd | Restores the previous value of the current directory saved by PUSHD. |
| 31 | prompt | Changes the Windows command prompt. |
| 32 | pushd | Saves the current directory then changes it. |
| 33 | sort | Sorts input. |
| 34 | start | Starts a separate window to run a specified program or command. |
| 35 | systeminfo | Displays machine specific properties and configuration. |
| 36 | time | Displays or sets the system time. |
| 37 | title | Sets the window title for a CMD.EXE session. |
| 38 | tree | Graphically displays the directory structure of a drive or path. |
| 39 | ver | Displays the Windows version. |
| 40 | vol | Displays a disk volume label and serial number. |