Home > Power User >
Command Line Interface

Overview

The Command Line Interface (CLI) is also known as a shell, console, command prompt or terminal. The first operating systems (like MS-DOS or UNIX) had neither graphical user interfaces (GUI) nor mice. Instead, tasks were performed by entering commands with the keyboard. An interpreter launched the desired application and returned the result on the screen. Sets of tasks could be launched using batch files to speed up a workflow.

Today, the notion of using the computer in this fashion seems outdated to most average users. The highly advanced graphical interfaces of Mac OS X and Windows XP are far easier to learn and use than the command line interface. The tradeoff, however, is that they offer less flexibility. Thus, power users still use the CLI frequently to perform special tasks:

  • Monitoring and killing processes
  • Remote access via SSH, SFTP, etc.
  • Compiling files
  • Compressing folders
  • Changing system settings
  • Running servers or accessing databases
  • Managing files
  • Troubleshoooting

OS X's aptly-named Terminal application is located in Applications > Utilities. Alternatively, OS X users can also use XTerm, which is part of OS X's X11 package (and will not be discussed further here). XP's Command Prompt application is located in Start > Programs > Accessories (alternatively, you can select Start > Run and type in "cmd"). XP users can also use command.com (which will not be discussed further here).

Settings & Features

The following table outlines the available settings and features of OS X's and XP's CLI offerings:

Mac OS X Windows XP Comments
User-customizable Settings
Cursor Size No Yes
Cursor Style Yes No
Line wrapping Yes No
Window size Yes Yes
Buffer Size Yes Yes
Window title Yes Limited While XP users can type "title" followed by the title they would like their window to be, OS X users can select from a number of dynamic attributes to be appended to their window's title:

terminal-title.gif

Keyboard Shortcuts Yes No While both operating systems have keyboard shortcuts for their terminal window, only OS X allows users to customize those shortcuts.
Font Yes Limited XP users can only choose from 2 fonts. OS X users can select any font on their computer for Terminal, and can even control leading (line spacing), kerning (letter spacing), font size, and anti-aliasing.
Text Color Yes Limited While XP users can select from as many colors as OS X users, identifying the right colors to use is not as easy in XP's terminal. XP offers RGB numerical input fields to select arbitrary colors. OS X provides its system standard color chooser, which includes a color wheel, multiple sliders (Grayscale, RGB, CMYK, HSB), a tool to grab the color of any pixel on screen, web safe colors, spectrum or any arbitrary image, and even a "box of crayons." Additionally, OS X users can select the color of the cursor in addition to the color of bold text.

OS X also offers 6 "preset" color settings (for both text and background colors) to choose from:

  • Black on white
  • White on black
  • Green on black
  • Black on light yellow
  • White on blue
  • Blue on white
Background Image Yes No OS X's Terminal honors transparent regions within images, and can be combined with overall window transparency. Option-drag an image onto the Terminal window to apply that image as the background image.
Background Color Yes Limited Refer to the comments in "Text Color" (above).
Background Transparency Yes No
Features
Full screen mode No Yes
Contextual menu support Yes No Use "Quick Edit" mode. See Copy and Paste support.
Drag and drop support Yes Limited Both operating systems allow you to drag and drop a file onto the terminal window in order to paste the path to that file. OS X additionally allows you to drag and drop text from any application/file/window into Terminal, and even drag and drop text from within the Terminal window itself. Option-drag an image onto the Terminal window to apply that image as the background image.
Copy and paste support Yes Limited XP's Command Prompt doesn't support the standard copy and paste keyboard shortcuts. Command.exe has its own proprietary copy/paste method called Quick Edit mode. Select text with the left mouse button or hit Enter to copy text. Click the right mouse button to paste.
Server connection bookmarks Yes No
Command history Limited Limited On OS X, new Terminal windows remember previous commands. While XP's Command Prompt doesn't do this, it does supply a popup list of previous commands.
Split screen Yes No
Store and recall multiple "sets" of settings Yes No OS X users can save "Library" files (saved in ~/Application Support/Terminal) and select them from File > Library. Library files can store every aspect of single or multiple Terminal windows, including their locations on the screen, and even what command the window is running. Here's a nice tutorial from MacDevCenter.com.

Wooden Brain Concepts offers some downloadable Terminal themes.
UTF-8 support Yes No
Auto-discovery of local servers Yes No Bonjour auto-discovery of local servers facilitates remote connections.
Secure keyboard entry Yes No According to Apple's Help documentation:
"You can set up Terminal to allow secure keyboard entry. This prevents other applications on your computer or the network from detecting and recording what you type in Terminal."
Protocols
FTP Yes Yes
SFTP Yes No
Telnet Yes Yes
SSH Yes No

CLI Keyboard Shortcuts

Command Mac OS X Windows XP
Select All -A
Copy -C
Paste -V Right-click
Paste escaped Text Ctrl--V
New Shell -N
Delete Delete Key Delete Key
Beginning of line Ctrl-A Home key
End of line Ctrl-E End Key
Quit -Q
Forward one character Right arrow or Ctrl-F Right arrow
Forward one word Alt-F Ctrl-right arrow
Backward one character Left arrow or Ctrl-B Left arrow
Backward one word Alt-B Ctrl-left arrow
Scroll Up Page Up or ctrl-L
Scroll Down Page Up
Scroll to Top Home
Scroll to Bottom End
Save -S
Undo -Z
Ctrl-shift-underscore
Clear scrollback -K
Auto-complete path (directory or file) Tab Tab
Enter EOF character Ctrl-D F6 or Ctrl-Z
Clear all macros Alt-F10
Cycle backwards through command history Up Arrow Up Arrow or F5
Cycle forewards through command history Down Arrow Down Arrow
Popup list of command history F7
Copy the current line up to the letter you input F2
Delete up to the character entered (delete characters from previous command) F4
Previous command (from current cursor position) F3
Previous command, character by character F1 (or Right Arrow)
Search command history Ctrl-R F8
First command in history Page Up
Last command in history Page Down
Cancel command (clear current line) Escape
Clear command history Alt-F7
Jump to specific command in history F9


Conclusion

On the whole, OS X's Terminal is more full-featured than XP's Command Prompt. Terminal seems to be geared a bit more to power users specifically, letting them fine-tune the application to their liking. Terminal also sports many advanced features that Command Prompt lacks, such as the ability to save "sets" of settings, auto-discovery of local servers, connection bookmarks, secure keyboard entry, split screen, and more.

In terms of keyboard shortcuts, Terminal and Command Prompt are comparable.

Mac OS X: 8
Windows XP: 5

Back Booting From Alternate Drives | Next Creating Screen Captures