User Interface Basics/Details

This page is a guide to some of the basics of dealing with computer user interfaces. This page may be more suitable for introductory guides, while more details about some more specific tasks are on a separate page about topics related to computer human interfaces.

User interface details (such as how to use a command line, and effective use of keyboard shortcuts):

A lot of this site focuses on supporting performing methods with the command line. There are several reasons for this, but the biggest key reason may be this: After knowing how to do something manually, knowing how to automate the process can be quite nice. For the purpose of automation, the command line is generally far superior to a graphical user interface. (Not only can the commands be run manually from a command line, and from script files, but most programming languages have a way to run a command line, making the command line methods fairly easy to integrate into various programming languages and to transition the code from one programming language to another.)

A graphical user interface can often be created fairly quickly to perform a task that has an automated method to perform this. Being sure to mention command line tools also may help people to become more familiar with using these tools, and familiarity is a good thing.

However, coverage of graphical tools is also used because often tasks may be most quickly performed using a GUI (due to the way that specific software is designed) and many people have some familiarity with using the graphical tools so understanding the graphical tools may be useful for communicating and interacting with other people.

[#cli]: “command line” interface (“CLI”) usage

Learning how to use a command line may initially be daunting, but it has huge benefits with unattended operations, including tasks that are started automatically (and tasks which can perform multiple tasks without interaction after they are started, even if they are started manually). Also, many commands may be easily accessed quickly, with little typing, and this may be faster than graphical approaches where many commands may require either burying the commands within an interface which is not visible unless accessed, such as a structure of menus or subscreens, or constantly using up screen space at all times in case the user wants to click on the command. Sometimes speed may simply be obtained because there is a command line tool that provides a faster option than a graphical method; this may be the case when a command line tool supports some advanced option that isn't accessible from a graphical tool (even if there isn't a strong, compelling reason why the graphical tool couldn't just have been written to support the advanced feature).

[#clihistr]: Recalling command line history

Perhaps the number one hint to provide, is to become familiar with on-the-fly recalling of command line history, and subsequently being able to re-run previous commands or altered versions of previously-run commands. Although it may not be technically required to perform some tasks, unlike some of the later steps mentioned here, this is mentioned first for a reason: to avoid some of the added intensity of command line hatred that is likely to be experienced by people who aren't familiar with using this.

If a command was mistyped, the entire command often does not need to be retyped. Try pressing the up arrow once. If a more recently command shows up, try pressing the up arrow again to view an even earlier command. Often that is the fastest way to re-run commands.

There may be some variations, including different keystrokes that may provide some different results. More details on this topic are on a separate page about command line history.

Related topics: configuring command line history, perhaps logs of user activity.

[#tabcmplt]: Tab completion

Another concept to be aware of is tab completion. For increasing speed when working with a CLI, this is probably the second most effective thing for people to become familiar with. (This first is recalling command line history.)

Simply type a partial filename or directory (folder) name, and press tab. If there is only one filename that matches, the filename will be completed. If there are multiple filenames, a supporting shell will usually do one of two things: complete the filename with one of the files that matches, or complete as much of the name as what can be unambiguously completed. If the first method is used, pressing tab again will erase the guessed letters and instead complete the previous partial filename with different guessed letters. If the other method is used, where only part of the the filename shows, pressing tab multiple times will cause the command shell to print a list of possible completions, and will then show a prompt with the text that has been typed (or filled out) so far.

Some command prompts may ignore a closing quotation mark which is part of a path; in such cases the closing quotation mark around a partial filename may not interfere with the command shell's ability to determine the possible ways to finish the partial text. When the tab key is pressed, the command shell may erase the incorrectly placed closing quotation mark and place it at the end of the text which has been completed so far, resulting in a file path (absolute or relative) which will work with most programs. This may take some experimentation to fully understand the ins and outs, but often times it allows even slow typists to be able to rival GUI methods in terms of speed.

Some forms of tab completion may recognize wildcards in a command line. Others may treat wildcards like literal characters, and find there are no matching names if tab completion is attempted with a wildcard.

In Windows NT 4.0, a command line completion may be supported but not enabled by default. TechNet article for NT Svr 4.0: Registry Tweaks notes that a REG_DWORD named HKCU\Software\Microsoft\Command Processor\CompletionChar can be set to 0x09 (where 0x09 represents the ASCII input caused by the tab key).

Note that this technique will often not work in software that uses the tab key for another purpose, such as using the tab key when using standard keystrokes in a GUI.

Running commands
e.g.: dir
[#cmdparms]: Using command line arguments/parameters/switches
Difference between a parameter and an argument

Information given to a program may be called a “parameter”. Information received by a program may be called an “argument”. The same information is both a parameter and an argument, just like a person going through a doorway may be simultaneously entering (one room) and exiting (another room). If a second person is in one room, that second person may think of the first person's actions as “entering”. Likewise, if the second person was in a different room, that person may think of the first person's actions as “exiting”. The same action is described by different verbs. The doorway itself may be thought of as an entrace or an exit.

A parameter is information that is given, while an argument is information that is received. Arguments are often, informally, referred to as parameters (recognizing that what is being received is a gift: a parameter from whatever is sending the information).

A switch

A switch refers to an option that is turning behavior on or off. Many command line programs recognize parameters that are switches. Informally, the word switch is often treated synonymous with the term “parameter”.

Commands that use the getopts API, which is commonly deployed in Unix, may often be able to combine some switches. So, command line parameters of “ -a -b” may be combined into “ -ab”. Some parameters may require multiple letters. These parameters (like “ --help”) are typically preceeded by two hyphens instead of just one.

Further details about how this may work in DOS-like environments is shown in the section about command line help.

In most environments, a space is needed between the command and the first parameter. In MS-DOS and compatible environments, the space might be optional if the “switch character”, which is most typically a forward slash (“/”), is used to separate the executable filename and the first “switch”.

[#clihelp]: Command line help
Unix manuals

In Unix, one option that might exist is a command named “ help ”. A lot of tutorials don't mention this first because the “ help ” command does not successfully provide information about most of the commonly available commands. Instead, the “ help ” command only provides information about commands built into the shell, and might only be available in some shells. (It is available in “ bash ”.) So, The advantage to the “ help ” command is that it is more likely to provide accurate information. It is less likely to work, but when it works, it works best (better than any other option).

For example, running “ help test ” may provide information about what happens if a person actually tries to run a command named test, while checking the system-wide manual for information about a test command may provide details about an external executable file that can be used, because it is an available option, but generally does not get used when there is also an internal option.

Actually, there is one other option which will typically be as accurate as running the help command, and that is to check the manual for the shell (which can often be viewed with “ man $SHELL ”). That information is also likely to be accurate. It is a bit longer to type, but the biggest downside to that approach is that using the shell's manual is often a lot slower. If the shell's manual is detailed enough that it describes the internal command that a person wants information about, then The shell's manual is likely to also provide a lot of other information (unrelated to the specific internal command that a person wants to learn more about).

To get help about a specific command, the most recommended method in Unix is often to run “ man topicName ”. (Actually, even better is to run “ man 1 topicName ” if the topic is in section one of the manual, or else customize the number as appropriate to specify another section of the manual. However, in reality, the first syntax usually works fine.) If that doesn't work, other commands that can be tried are “ info topicName ” (to read information, possibly using the GNU info command) or “ apropos topicName ” (to try to identify a man page).

These are often some of the most useful, informative sources of information about the basics of running a command. (Naturally, even further details might be available in source code.)

If these commands don't work, try some of the more general alternatives listed in a following section.


Try “ help topicName ”.

If that doesn't work, there may be a small number of computers where “ QBASIC/QHELP topicName ” might work.

Another option may be to run: “program /?” or, an alternative that works just as well, “program/?”. Note that neither of these options, especially the latter one, is likely to work in many Unix environments. If the command line recognizes the character as a switch character, then a space before (the first, or perhaps even any) occurrence of the switch character may be optional. Many programs may also support hyphens as a switch character. However, the first space is typically not optional in that case, because the command line shell does not have any special recognition of that character being a switch character.

Other alternatives
Try “ program -? ” (which probably does not need to be escaped, but might need to be), or “ program --help ” or “ program -h ” or just running the program by itself (with no parameters). Note that in some cases, many programs may functionally perform with some of those options, such as no parameter or using just a “-h” parameter. (Actually, with some programs, there is some risk of that with any of the parameters being recommended here. However, some parameters might be more common to be treated as a request to do something rather than a request to learn how to do something.)

Beware that not all commands do the same thing. Although -h is fairly standard, it certainly may have other meanings. (Another common meaning for -h is “human-readable”, affecting output of commands like df and du and ls.) Running a command with no parameters may also cause the program to act, instead of providing help. (This has been seen on a trimmed-down Linux distribution, causing a device to start shutting down.) The scariest story I've heard was from a script that ran “rm -r /users/$1”. Someone wanted to remove a single user account, and ran that with no parameters, hoping to get some quick help to show the syntax. The result (clear for those who are experienced with shell scripting) is that this ended up proceeding to delete all of the data belonging to all of the users.

Other options
Use the world wide web. If source code is available, UTSL.
Making a directory
(Information in this section may be redundant with information in the handling data section and/or handling files section. However, that section may have further details.) mkdir is most likely to be most compatible.
Changing current directories

... (Details should get added here.)

For a similar/related topic, see: showing current directories

Removing directories
To remove a single directory which is empty, use the rmdir command (as noted by the section on removing directories/folders).
Environmental variables
See Environmental variables (operating system, or command processor, variables).

The Environmental variable (operating system, or command processor, variable) known as PATH is commonly used (in both MS-DOS and Unix) to check for executables. This means that if a command is referenced, the file used to execute the command may be located if that file is located in any directory (a.k.a. “folder”) that is referenced by the PATH environment variable. Multiple directories are separated with a specific character: in Unix this is a colon and in MS-DOS this is a semi-colon.

The PATH variable's value may not be quite so impactful, and may be ignored entirely, if the command being run includes a reference to a directory's location. (In DOS, this would include a reference to a drive letter.) So, the PATH variable is not going to be used at all if a DOS command stated “ \Command ”. Similarly, a slash appearing before the first non-escaped white space in Unix may indicate the executable is in a specified location.

Some things to know about the implementation in MS-DOS: There is an implied “.;” at the start of the path: this means that a file in the current directory will be executed without any regard to the contents of the PATH variable. Also, particularly in old DOS operating systems, the path may have a length limitation that can, with some frequency, be impactful. (This might be able to be worked around by using commands that allow drive letters to point to certain locations.)

In Unix, the behavior of MS-DOS could be simulated by starting the path with a reference to “.:”. However, this is widely considered to be an excessively poor practice: it is expected that a system administrator should be able to rely on certain programs in the path without the risk of an unauthorized program being in a subdirectory. This is an even higher concern in Unix than DOS since many standard file handling commands, such as commands used to view contents of diectories and/or copy data and/or delete data, are external executable files.

Finding executables in Microsoft Windows

This can be a bit more complicated. There are different ways of running a program, and those different methods may hae different processes to determine where to look for executable files. For instance, if using the ShellExecuteEx function, the process is documented at: MSDN: Application Registration: section titled “Finding an Application Executable”

[#wildcard]: Pattern/expression matching in strings related to file systems

Some people may typically use the term “wildcard” to refer specifically to one reserved “symbol” being able to refer to one or more characters, typically implemented with a single * character, while other people may refer to similar symbols that perform pattern matching as wildcards. Other terms include pattern matching or expression matching.

MS-DOS style wildcards

MS-DOS supported only two wildcards: these may be the most commonly supported wildcards. (Possible reasons for their wide-spread support include already prevelant widespread use for a long time, easy manual re-implementation by starting with these, and general usefulness.) These wildcards are ? and *.

The ? wildcard generally means a single character. So, a? would match a file called “ab” or “ac”, but not a file with a name of “a” or “ace”. However, in at least some implementations of DOS, this may also effectively refer to one or more implied NULL characters at the end of a filename. So a??????? might match both “abcdefgh” and also “ace”.

In general, * refers to some (variable) number of ? characters. For example, abc* would match abcd and abcde and abcdefgh. There may be few of any restrictions on those charcters: In some cases a * may match zero or more characters, although sometimes implementations treat * like one or more ? character.

In DOS specifically, any characters after the * character may be ignored. For example dir a*b.tx? may ignore the “b” character which is part of the base filename before the extension. The .tx? is not ignored because it is understood to refer to the start of a filename extension. In some cases, it appears the * may be literally treated like eight ? characters, because the software may actually output the ? characters in part of some output. The extra characters do not cause a problem with exceeding the length limitations of the base part of the filename or the extension: the command is still valid and the extra characters after the length limit are ignored. However, any extra commands are also ignored.

In MS-DOS, * and ? cannot refer to a period which is part of a standard “eight dot three” filename. Therefore, * (or “*.” (asterisk, period), which is effectively the same) does not refer to all files, but just all filenames that do not require an extension to be specified. *.* does refer to all filenames, including those that do not have an extension.

Note that the command line interpretor generally does not make any real attempt to expand the wildcards before passing the text to the program that is being run. These wildcards are simply ones that are commonly supported by DOS programs, including DOS programs that are built into the command line intrepretor. (Namely this especially means the commands dir and copy and del and the equivilent to del which is erase. These may also be supported rather commonly by at least some external progarms, including xcopy and deltree. Support by some other commands, such as cd (and its equivilent, chdir) may vary a bit more (so some implementations may support it, while others don't).

One way to enhance wildcard handling notably is to replace many of the commands with more advanced commands that support different wildcards. For example, JP Software's command line shells have much better implementations of many commands that come with MS-DOS. Typically those command line shells have been shareware at the time of their initial release, but some command line shells, including 4DOS, have become freeware with source code available.


This section is inadequate as it barely scratches the surface; this section needs and deserves expansion...

In Unix, many programs, notably including many command line shells, support multiple pattern matching “symbols”, which may be single characters (like MS-DOS's ? and *), and possibly multi-character sequences such as [ ... ]. This leads to quite a bit of additional flexibility, as well as an increased need for escaping.

[#unxastrk]: Asterisks in Unix

For the most part, The * is generally implemented a bit more sanely than MS-DOS's. However, one thing to note is that this will often not show “hidden” filesystem entries (a.k.a. hidden files and directories), which are filesystem entries with a name that starts with a period. So, listing all of the files in a directory may require doing something like:

ls -l somedir/* somedir/.*

Be very careful with that sort of expansion if trying to use recursion! For instance, consider the effects of the following command (which removes/deletes filesystem entries) before it is run!

rm -R somedir/.*

This would include somedir/.. so the higher-level (“previous”) directory, including all of its subdirectories, will also be recursively deleted. (It would be safer to first list what hidden files exist, and then carefully specify what other filesystem entries, perhaps by using some sort of additional “wildcard”-ish/“meta”/expandable characters.)

A popular set of wildcard matching is to support a “regular expression”. The term “regular expression” is abbreviated as “regex” and generally means supporting certain specific pattern matching sequences that have been supported by historical versions of programs including grep, sed, and the PERL programming language. Others very commonly used programs which may support regex's (might ... this may still need to be verified) include more and less and vi, (possibly when searching for text).

[#batscrpt]: Handling batch/script files

As a generalization, running a series of commands more than once can often be done easily by placing the commands into a batch/script file, and then running the file. The commands may be placed into a text file by using redirection to a text file or by using any other method to edit a text file (using software that is designed to easily edit text files).

Batch files
Making and running a batch file
In DOS, make a file that has a filename extension of .BAT. If the file is called KeepFile.BAT then the batch file may then be run by running KeepFile.BAT or by just running KeepFile at the command line. (However, batch files are third in the common priority of executable filetypes, behind files that end with .EXE which are themselves behind files that end with the .COM extension.)

e.g. %1 %2 etc.

A batch file similar to the following (but often not doing the error checking) could often be found on computers by people who interacted directly with MS-DOS versions prior to version 6 (which introduced a MOVE.EXE which probably had some better error checking than this batch file). The batch file could be named MOVE.BAT and contain the following text:

@echo Off
COPY %1 %2
If ERRORLEVEL 1 goto copyprob
If exist %2 goto copyokay
::goto destprob
:destprob echo Old file not deleted because destination does not seem to exist.
goto showparm
:copyokay del %2
goto end
:copyprob echo Old file not deleted because it seemed like there was an error.
::goto showparm
:showparm echo First parameter was: %1
echo Second parameter was: %2

It is believed that %10 will be treated like %1 followed by a zero. Running running “Example.BAT testone testtwo test3 test4 test5 test6 test7 test8 test9 testten testeleven”, if the batch file looked like “@echo %9 %10 %11”, would result in output of “testnine testone0 testone1 ”. The only way to deal with more than nine parameters (which is probably not terribly common) is to use the rarely-invoked shift command.

Unix “shell script” files
Making a shell script

It can be helpful to start with a comment that references which shell is to be used. In some cases (e.g. Qemu running a script to configure a NIC, though there is are probably more cases than just that, probably from a much more generalized rule), this may help a file to be successfully run. (Perhaps the OpenBSD Manual Page for the system call named execve may be a relatively authoritive source of documentation?) Although some official-looking documentation may show a space after the first two characters, many scripts commonly do not have that space and they do work fine. So, although in some cases this may not be necessary, it can be helpful to start a text file with this sort of comment.

Running a script file

There are two ways to run a script file in Unix. These two methods use different permissions. (For information about setting permissions, see file attributes.)

If the file has execute permissions, one may run it similar to any other executable.

The other method involves just using read permissions. To run a script file that way, if the script file is at $SomeDir/bin/myScript then run something like the following:

. $SomeDir/bin/myScript

To be abundantly clear, the command line there starts with a single period and then a space. This tells the command line shell to load the text file like a script file, regardless of whether there are execute permissions (although read permissions are required), and regardless of whether the file starts with a header that looks like a comment identifying the shell to use. In some cases having those two characters on the command line may be unnecessary, but when those two characters do matter, they usually help make things work as expected.

(When using the bash shell, starting a command line with a period and a space will cause the same effect as using the source command that is built into that shell. However, the method of using a period and then a space also works with OpenBSD's ksh, which does not support an internal command named source, so the method of using a period and then a space is more compatable.)

It has been found (and so is probably true for all cases) (using ksh as a command shell) that running a script with “ scriptName ” would cause any exported variables to be forgotten when the script finished, but using a period and space first (running “ . scriptName ”) would allow those variables to retain their value after the script finished. There is some logic to this: the idea of using the period and space (running “ . scriptName ”) is that the shell reads the file and executes the commands in the shell. The idea of running the command directly is that the shell runs a command, so apparently that command may simply be getting run in a bit of a more “sandboxed” (separated) environment.

In some cases, however, removing the period and the space may be preferred. The most glaring example is if a file has execute permissions, but not read permissions. Another example might be a case where a program, other than a command line shell, tries to just treat the script file like a standard executable file, and tries to just execute the script file.

Many script files may start with a comment that identifies what shell is supposed to be used with the script file. This may be particularly useful when the script file is executed directly. A text file may (in at least some cases) not be considered to be an executable script file without this sort of command. (That may matter more if the script file is being run as an executable, and may matter less of a command line starting with a period and then a space is being used to cause the file to be read.)

Another common way of running a script may be to run:

$SHELL $SomeDir/bin/myScript

While learning about running files on the Unix command line, be sure to check out the section about background tasks in Unix.

Handling parameters in Unix scripts

Generally $1 refers to the first parameter passed to a program, $2 refers to the second parameter passed to a program, and so forth. Using $0 may show the command that was run on the command line. (Expecting a specific value for $0 can be problematic because a program may be referred to using different names. Most commonly, programs in the $PATH are referred to without any path, but a program's full path is another likely option, and a large number of possible relative paths are also possible, especially if using inefficient references like using ./ more than what is necessary.)

Using $* may show multiple parameters. Using $@ may show multiple parameters.

Background tasks
[#unixbg]: Unix

There may be various ways to run multiple programs in Unix. For instance, programmers may call functions for Unix to fork code. The following are some of the ways most commonly done by end users:

Terminal Multiplexing

The most popular programs for this are tmux and the older program called screen. (There might also have been a window command providing some similar functionality?)

Both tmux and screen can be directly interacted with using a special keystroke combination. For tmux, the default keystroke combination is Ctrl-B. For screen, this is Ctrl-A. (As these are control sequences, those letters needn't be capitalized, meaning the shift key is not needed when pressing those combinations.)

Both allow creation of a window using the command keystroke combination followed by c. Then, both allow the user to see a list of windows by using the command keystroke combination followed by w. (tmux's full screen display is a more verbose display, while screen crams its report into a single-line status bar and so does not take up more of the screen.) Then, both pieces of software allow the user to see the contents of a window using the command keystroke combination followed by the number of the window. Both allow detaching of the session (which can then be resumed later) using the command keystroke combination followed by d. Both allow online help by pressing the command keystroke combination followed by a question mark.

The terminal multiplexers may also add some functionality like scrollback and copy-and-paste. (These might be less appreciated in graphical environments where this functionality may be implemented in other ways. In other environments, where there is not another convenient method of “copy and paste” functionality already implemented, this feature may commonly be much more highly appreciated.)

Further details are available in a section about terminal multiplexers.

Backgrounding from the command line

This may be shell-dependent.

A simple method to background a program immediately, upon it being started, is to put a(n optional?) space and an ampersand (“ &”) after the rest of the command line. That may cause the script file to run in the background. (However, the script may still output to the terminal, causing output text to interrupt whatever might be getting typed on a new command line.) If a script file is unlikely to rudely interrupt typing on a command line, and if backgrounding the task won't cause a race condition, that may be a very convenient way to use some of Unix's multitasking capabilities: that may allow the command prompt to instantly become usable again.

Upon running a command in this fashion, the command shell may show the program's PID, and then show a usable command prompt.

For details about interacting more with a backgrounded task, see the section about suspending a task.

If a backgrounded program exits, the shell may report an update the next time the shell shows a new command prompt. (Simply pressing the Enter key at a blank command prompt may cause a new command prompt to show.)


It may be wise to try this in a controlled test environment before trying this on a critical task. The commands provided in this tutorial may be internal to some command shells, and so documentation of the commands may be included in the manual page for a command shell that is being used. This documentation was based on using OpenBSD's ksh shell.

Run a program, such as:

man sh

Press Ctrl-Z. (Since Ctrl-Shift-Z and Ctrl-z are treated the same with control sequences, the shift key does not need to be pressed.)

That will often suspend the currently running program, perhaps after showing some brief output (like ^Z), and then the shell may show an update of the status of the program that was just suspended, and then the user may be presented with a command prompt. (The “caret” character is meant to imply the Ctrl key, as noted by control sequences.)

To view the list of suspended jobs, run jobs

Example output (after running several commands):

$ jobs
[6] + Suspended            cat
[5] - Suspended            cat >> /tmp/cattest
[4]   Suspended            bc
[3]   Suspended            man sh
[2]   Suspended (signal)   nano -zw job3
[1]   Suspended (signal)   nano -zw job2
$ jobs

The number in the brackets may refer to a job number.

To allow a program to start resuming again, run “ bg %1 ” if the program is job number 1, or else modify the example command line to reference a different job number. This will unsuspend the program, and let it actively run in the background.

To again be able to interact with the program, use “ fg %1 ” if the program is job number 1, or else modify the example command line to reference a different job number.

Each job is rather tied to the terminal. If using another terminal, the output of the jobs command may differ.

Using X
A window manager in X Windows should allow some sort of change for what program is the current foreground application. (This would cause any other previously-foregrounded program to become backgrounded.)
[#lkcliprm]: Customizing the display of the prompt
bash and OpenBSD's ksh (and perhaps others)

In Unix, typically a standard user's prompt is differentiated from an elevated command prompt with superuser powers. Most commonly, a standard user's prompt ends with a dollar sign, while a superuser's prompt ends with a hash mark. This might be because a prompt character sequence of “\\$” supports looking different based on the active user's reported UID. The prompt may set using an envrionment variable, possibly called PS1 (and perhaps similar changes can be made to some prompts by altering variables called PS2 and similar, such as PS3 and possibly PS4. The manual page for the shell is likely to document which variables are supported, and what prompts each variable impacts).

For example, consider making a file called ~/myprompt with the following contents:

export PS1=\[\\!\]\\u@\\l:\\h:\\w/\\$" "


export PS1=\{\\!\}\\u@\\l:\\h:\\w/\\$" "

Hint: If including a terminal name, SSH sessions might commonly show the same terminal name, like “ttyp0”. If ever a prompt is shown with a different terminal name, like “ttyp1”, that may be an indicator that another terminal has an SSH connection to the same machine. That may be a reminder to resume a backgrounded session, or an indication that somebody else has logged onto the machine.

Then run that as a script file. Actually, the best way to do that may be to source the file, so that the file doesn't just modify a temporary copy of the prompt variable. This is described by the section on handling batch/script files and may be done by running a command that consists of a period, a space, and then the filename. For example, run the following:

. ~/myprompt
echo ${PS1}

The previous example may create a prompt that looks something like:


Note: Many people like short prompts. They can be nice. However, if regularly performing remote access on multiple machines, showing quite a few details can actually be really, really nice to help ensure that commands are being ran on the desired machine.

(The trailing slash, shown after the directory name that generally does not end with a slash, may look a bit odd if the current directory is the root directory since that directory's name does typically end with a slash.)

Coloring the prompt

Note: Adding colors to the prompt can cause some side effects. For instance, typing a long command line may cause word wrapping to occur at a location other than what is expected. Another possible issue is that command line recall may not display things very sensibly. (It is often possible that a cursor may move to the beginning of a line with characters, and characters may get overwritten.)

However, for the daring...

Here is a bit of a more elaborate text file that could be used. (This could be enhanced further by checking for a terminal type, and not putting in color codes that may be visible on non-supporting terminals.)

export PS1=\\u"\e[0;31m"@"\e[0;37m"\\l:"\e[1;31m"\\h"\e[1;33m"\[\
"\e[0;37m"\\!"\e[0;33m"\]"\e[0;36m"\\w/"\e[1;32m"\$"\e[0;37m"" "

Note: The above does not use the excellent idea by ocicat in Forum post about shell prompts: commentary about prompt colors. Applying that advice, and drawing in from some other resources, make some variables like these:

export ECMA48_ESC_BLACK="\e[0;30m"
export ECMA48_ESC_RED="\e[0;31m"
export ECMA48_ESC_GREEN="\e[0;32m"
export ECMA48_ESC_YELLOW="\e[0;33m"
export ECMA48_ESC_BLUE="\e[0;34m"
export ECMA48_ESC_MAGENTA="\e[0;35m"
export ECMA48_ESC_CYAN="\e[0;36m"
export ECMA48_ESC_WHITE="\e[0;37m"

export ECMA48_ESC_BLACK_BOLD="\e[1;30m"
export ECMA48_ESC_RED_BOLD="\e[1;31m"
export ECMA48_ESC_GREEN_BOLD="\e[1;32m"
export ECMA48_ESC_YELLOW_BOLD="\e[1;33m"
export ECMA48_ESC_BLUE_BOLD="\e[1;34m"
export ECMA48_ESC_MAGENTA_BOLD="\e[1;35m"
export ECMA48_ESC_CYAN_BOLD="\e[1;36m"
export ECMA48_ESC_WHITE_BOLD="\e[1;37m"
  • (A prior version of this guide had the varibale names start with “ANSI_” instead of “ECMA48_”. However, in light of research showing that these codes seemed to historically originate from the ECMA48 standard's “SGR” section, and not the corresponding section of the ANSI standard, this creator of this guide decided to honor historical accuracy and update the above examples.
    • Perhaps a common reason these became known as “ANSI” escape sequences was MS-DOS's ANSI.SYS file which implemented support for ANSI escape sequences, as well as implementing these ECMA48 sequences, and typical end users didn't know the (perhaps not prominently-documented) difference when they read about ANSI escape sequences?
  • (For more information about such escape sequences, perhaps see also: Historical ascii-table.com as archived by the Wayback Machine @ archive.org: paged titled ANSI escape sequences?)
  • Some of the above variations may often be known by some different names/descriptions:
    • “white” may often be more of a color resembling “silver” (as specified by standards like HTML color codes). To really get a more decently pure white, specify “Bright White”. (Some people might associate “silver” with being a bit more blue-ish.)
    • Bright Black might be more accurately described “grey”/“gray”, a bit darker than what is often called silver.
    • Using “Bright Yellow” will typically involve very heavy amounts of cyan and magenta, with very little blue. Using “yellow” has been known to vary somewhat significantly between some different terminals, sometimes looking rather orange but sometimes looking more like “olive” (from the HTML color codes). A demonstration of some of the differences has been posted at Wikipedia's page titled “ANSI escape code”, section titled “3-bit and 4-bit” (Colors). (A horizontal scroll bar, at the bottom of a table, may typically need to be used to see some of the available posted colors.)

    Then, the prompt may be stored in a way that will be much easier to change later. For instance, if years later there is a desire to change something from red to green, that can be done by simply referring to the correct environment variable, without needing to go look up an ANSI chart. For example:

    • (The following line was quite long, and so a horizontal scroll bar was added to just that line so that this broader section didn't expand to such an unnecessarily wide width.)
    export PS1="${ECMA48_ESC_WHITE}"\\u"${ECMA48_ESC_RED}"@"${ECMA48_ESC_GREEN}"\\l"${ECMA48_ESC_MAGENTA}":"${ECMA48_ESC_RED_BOLD}"\\h"${ECMA48_ESC_MAGENTA}"\[\
    "${ECMA48_ESC_WHITE}"\\!"${ECMA48_ESC_MAGENTA}"\]"${ECMA48_ESC_CYAN}"\\w/"${ECMA48_ESC_YELLOW}"\$"${ECMA48_ESC_WHITE}"" "

    This may make a prompt that looks something like:


    Of course, a user may type a command, such as:

    username@tty#:hostname[1]~/$ sudo -in $SHELL

    Using the above example command, the root user's login script will run. That may choose to color-code things different, which may help to make a root shell be a bit more noticeable.


    Before committing to using the colored prompt on a long-term basis, be sure to check out how well the prompt works in action. Test it out. With at least some “command prompt”/“shell” programs, usage of ANSI escape sequences and certain actions may caue the visible prompt to be rendered in a way that may not be expected. For example, try typing a very long command line, which is more than 160 characters long, and then also use command line recall. Make sure that these actions do not visibly break the prompt's display in any unacceptably undesirable way. Ensure success when performing these simple tasks before investing in any sort of widespread deployment of these customizations.

If the results are desirable, then (back up the file that is about to be modified, and then) run:

echo . ~/myprompt >> ~/.profile
csh / tsch
See: csh colors

Further details (including additional examples) of a prompt may be at: LX0-103 Tutorial: Unix Environment/Variables, “Common Variables” section, sub-section titled “PS1


A default value of $P$G is common, and may be overridden using the PROMPT command or by manually setting an envrionment variable named PROMPT (which might not pre-exist).

Graphical Interfaces
Speed advantages of a keyboard

Learning how to interact with the keyboard improves speed more than what is realized by most people who haven't learned the most common keyboard shortcuts. The simple act of moving one's hand to and from the mouse takes more time than what is taken to press a key, and perhaps even a series of keys which is memorized (especially if memorized with “muscle memory”). Perhaps less applicable in many cases, handicapped users, such as those with blindness, may not prefer highly visual interface methods such as mouse movements. Another type of case where a keyboard may be much nicer is when trying to perform an action over slow remote connection where the screen does not update very quickly. Another case where the keyboard may work better is when a system isn't very responsive, possibly because it is accessing the hard drive a lot, such as when Microsoft Windows systems have just been started. In some cases, multiple keyboard commands may be implemented by pressing one key after another and queuing keystrokes if the system is not ready to respond and/or process all of the input immediately. In contrast, using a mouse may require waiting for a graphical object to appear before that object can be interacted with by interactions that involve using the mouse cursor. In some cases, particularly on less responsive systems which are not very quick nor pleasant to use the mouse cursor with, a graphical interface object may even be able to accept input before it is fully displayed, potentially reducing the need for graphics to be loaded and rendered and resulting in a faster experience.

Speed advantages of a rodent
In many cases, the fastest method of performing certain operations is often to use a rodent. (A “rodent” is a “mouse-like device”, including mice and trackballs.) For example, resizing a window, particularly if resizing to a specific size, is often able to be done most quickly using a rodent. (However, specific predefined sizes, such as minimizing or maximizing a window, may be able to be reached most quickly with a keyboard.) Also, using a rodent to select a hyperlink out of a list of hyperlinks can be faster than a common alternative keyboard approach, which is requiring that the list be tabbed through. Although most well-designed programs do not require a rodent for any basic functionality (with graphics editors being a noteworthy exception), some may require a rodent to perform some tasks. The keyboard may often be used as a rodent, such as using the MouseKeys feature of Microsoft operating systems, although that is often not the fastest way to do things.
Common usage
When working with other people who use the graphical interfaces more often, using a graphical approach may be a more familiar approach. For that sole reason, using a graphical appraoch may help to communicate more clearly or quickly with such users. Some extremely common tasks may be more likely to be able to be performed with a method that is quickly accessible when using the graphical approach: for this reason there may be speed advantages to being familiar with using the environments that many computers will be using.
[#kbingui]: Using a keyboard in a graphical interface:

Here are some keyboard controls that are commonly used in interfaces that rely on the familiar elements of “Windows, icons, mouse pointers” (“WIMP”), buttons, and menus. Knowing many of these has led many people to be thought of as a young computer wizard who, at least for that person's age, knows a lot about computers. Many people may know some, but not all, of these details. That can be particularly impactful when a person is creating a program's user interface: programmers may be inclined to create an interface that does things the way they are used to. If they do not include support for a common navigation technique just because they are unaware of that method of doing things, their program may not support a method of input that a user would like to use. Hopefully this material may help speed some people up, make some people appear to be more knowledgable (and even be more knowledgable), and may help some software have a user interface which is more consistent with the standards that some other people are using.

Those who are familiar with computers are advised to read this section if they are interested in spending a bit of time seeing if they can learn more which will enable them to have increased familiarity and speed.

Accessing a menu:

The main menu can typically be accessed by pressing either of two keys: F10, as specified in the older “Common User Access” guidelines, or by simply pressing and releasing the Alt key. Then a specific menu, can be pressed by pressing a specified key that represents that menu. For example, a person can press the space bar for the programs “system menu” (which is the same menu that shows up if a person uses a rodent to click the icon in the upper-left corner of the window). For many programs, another option may be to press the F key which often accesses the “File” menu. Many times, after pressing and releasing Alt or F10 to start accessing a menu, the space bar can be used to call up the system menu and the menus may each have an underlined letter. This underlined letter, called a “mnemonic access character” and represents a letter that may be pressed to call up a specific menu.

Alternatively, the menus can be accessed by holding Alt and pressing the secondary key and then releasing Alt, such as holding Alt and then pressing F for the file menu and then releasing the Alt key. This slight variation, often documented with notation such as “Alt-F” (meaning to hold down the modifier key which in this example is the Alt key, press the F key, and then release the modifier key), is not functionally much different for end users than pressing Alt and releasing Alt before pressing the secondary key. (Note that holding Alt and pressing numbers on the numpad may commonly be interpreted as a different intent: inputing an “Alt code”.)

The program's “system menu” may be accessed by pressing Alt-Space. (In Windows 3.1, the icon in the upper-left corner of programs was not a minature version of the program's main icon, but rather a picture of a horizontal line which supposedly represented a space bar.) A similar menu for a sub window, such as documents within a word processor that uses the “multiple document interface” (“MDI”), could be accessed with Alt-hypen, perhaps because the drawing of a hyphen (a short horizontal line) visually looks like a small version of what the drawing of a space bar looks like (a long horizontal line).

Another alternative is to select a menu (which isn't opened/expanded) by pressing Alt (which will highlight the left-most menu except for the program's “system menu”), or in some cases by choosing a menu (such as pressing Alt-Space or by pressing Alt-F or by clicking on a menu) and then pressing the Esc key. Once a collapsed menu is selected like this, other menus may be selected (without being opened) by using the left and right arrow keys. A menu may be opened by pressing either the down arrow key or the enter key when the menu is highlighted, or by pressing a hotkey specific to that menu (even if a different menu is selected, as long as the other menu is not opened/expanded).

“Menu button”

Some programs, including Mozilla Firefox and Chromium (and related products, like Google Chrome), may show a main menu using an icon that has three horizontal bars (arranged vertically, one on top of the middle one).

In Chromum (and related products, like Google Chrome), this may be reached with Alt-F (like the old “File” menu), or by just pressing Alt and then Enter. (Alaternatively, pressing Alt and then a sideways arrow key may select other options on the navigation bar.)

According to Microsoft's Speech Recognition, the name of the menu is named after the program. For example, saying “Firefox” or “Chromium” may pull up the menu (as determined by hints shown after using the “Show Numbers” of Microsoft's voice recognition from Windows 7, documented in the section about speech).

The thread from Bugzilla for Mozilla: “Bug 575279 - Add keyboard shortcut for the Firefox menu button”, Comment 32 indicates that there from is no keyboard shortcut, and that specific comment indicates that but Alt-F will be used. Comment 15 of the same thread notes, “There's no point in doing this as long as the menu content isn't keyboard-accessible.” Even if the menu is clicked with a mouse, the menu doesn't respond to a typical keyboard interface anyway. Therefore, there is no urgency to try to make the menu show up with the typical keyboard interface.

In some cases, one of the first-level (main) menus of a program is shown (opened/expanded), and a hotkey is pressed which doesn't correspond to any of the options on a submenu of the currently opened menu, that hotkey press may check if a neighboring first/top-level menu uses that as a hotkey keyboard shortcut. If so, pressing that key may open/expand that menu (closing any other menu that may have been expanded).

With some programs, a menu may be reached by pressing the Escape key.

[#cntxtmnu]: Accessing the “context-sensitive menu”/“context menu”/“shortcut menu”/“alternate menu”/“secondary menu”/“right-click menu”
Performing this can be done by pressing Shift-F10. The choice of F10 is logical since, like the Alt key, the common user access (“CUA”) standard indicates that pressing F10 will typically bring up the program's main menu (using the “common user access” control scheme adhered to by multiple interfaces). This is admittedly one of the cases where a mouse is often superior, because pulling up the correct context menu may require that a desired object or area is first selected. Moving the mouse to a specific area and pressing the right mouse button when the cursor is at the desired location may often be faster than trying to select the correct area with the keyboard (perhaps by using arrow keys) and then pressing Shift-F10 (especially since F10 is often located inches away from the arrow keys). However, if the right item is already selected for whatever reason, Shift-F10 may be a time saver.
Choosing a menu option

Once a menu is selected, menu items may display two types of keyboard shortcuts. One is an underlined letter that may be pressed when the menu is selected. For example, on the File menu, pressing S may save (if that is the hotkey that is used). The other is a hotkey sequence, such as Ctrl-S, which can be pressed during the program's most commonly used interface. For example, in a word processor, pressing Ctrl-S while editing a file may save, and that keyboard shortcut may be shown to the right of the “Save” menu option that is displayed when the File menu is being viewed. Such hotkey sequences, such as F1 which may be shown on whichever entry on the “Help” menu is usually used to show help, may be a single character. More often these hotkey sequences may involve pressing the Ctrl key, such as Ctrl-S to save.

The most effective way to know about the fast methods of performing tasks is to use the fast methods. Because keyboard hotkey/shortcut combinations are faster, it takes very little practice for them to become the intuitive, natural method. The second most effective way to know about the commands, and a key way to learn them, is to see the keyboard shortcuts regularly.

In addition to pressing a hotkey to choose a menu option, a method using the keyboard is to use arrow keys to highlight a desired menu option, and then to press Enter to select the highlighted option. Selecting a sub-menu then begins to show the sub-menu. Sub-menus may be implemented a bit differently, in that backing out of a sub-menu (to a previous submenu or perhaps the program's main menu) may be done with either the Esc key (which also might close the menu entirely) or the left arrow key (which may choose the “previous” menu to the left of the currently selected one). If a sub-menu is highlighted, then pressing the right arrow key may drill down into a sub-menu or, especially likely if the currently selected/highlighted item is not a sub-menu, the right arrow key may proceed to both close any visible sub-menus and display the next menu on the main menu. (The section on showing a menu has more information about choosing a different menus without being affected by sub-menus, such as when a menu is selected but not shown opened/expanded.)

[#shokbhtk]: Displaying Hotkeys

With newer versions of Microsoft Windows, many programs will not show an underline under a letter to show which key represents the fast method of selecting a menu option, unless these shortcuts are enabled through one of the “Accessibility” options in the system's control panel. Enabling this is recommended as the underlines tend to cause very little distress to those who don't know what they are for, and it helps people learn the keys much more quickly.

Enabling Hotkey Displays in Windows Vista (and Windows 7)

Start, (possibly Settings,) Control Panel, “Ease of Access Center”. Once there, in the “Explore All Settings” section, choose the “Make the keyboard easier to use”. Go to “Make it easier to use keyboard shortcuts” (scrolling down to the section named that in Windows Vista, or clicking on the hyperlink which says that in Windows 7). Check the (sadly, unchecked by default) checkbox called “Underline keyboard shortcuts and access keys”.

(While right there, “Turn on Toggle Keys” may not be a bad thing (although that also might be easy to do later by holding down Num Lock for 5 seconds). Doing this could potentially inform a knowledgable user of some accidental key taps.)

Then Apply, and then Save (in Windows Vista) or OK (in Windows 7).

Enabling Hotkey Displays in Windows XP

Guide that indicates to do this: From the “Display Properties” (control panel applet), go to the Appearance tab and then choose the Effects button. The checkbox is called “Hide underlined letters for keyboard navigation until I press the Alt key”.

(There might also be a way to do this through Accessibility?)

Ubuntu settings
Likely this would be anything with Gnome, and not Ubuntu-specific? documentation, Forum thread showing to set gtk-enable-mnemonics to zero in a ~/.gtkrc file. Another forum thread indicates this should go into .gtkrkrc-2.0

Office 2010 may show keyboard shortcuts in little boxes which look similar to the tooltips that are shown when a rodent cursor hovers over an item with a tooltip.

Sometimes people have referred to the underlined keys as “Alt keys”, because they can be accessed with keyboard combinations involving the Alt key. However, the term sounds rather close to “alt code” (see: keyboard (numeric) alt codes). So it is more clear to refer to this as keyboard hotkeys or, even less specifically, part of the standard known as Common User Access (“CUA”).

[#menuribn]: Microsoft's “Ribbon”-style menu

Users of newer versions of Wordpad may wish to reduce the amount of graphical space taken up by the ribbon interface. Some programs may have a graphical widget to minimize the screen space used by the ribbon: this may be located in the upper-right corner of the area below the title bar.

Some programs may not have that widget. An example is Wordpad. Users of a rodent cursor may do this by right clicking on the name of a tab (such as the “Home” tab or the “View” tab), which brings up a relevant context menu. (Perhaps unlike some other software, just right clicking on the ribbon itself does not present this option. What needs to be right-clicked is, quite specifically, the tab that is above the rest of the ribbon.) For a keyboard-only method of doing this, press Alt to start accessing a menu, and then press Shift-F10 which brings up a context menu for a menu tab. Either method of accessing a context menu will show the “Minimize the Ribbon” option. Even faster, double-clicking a tab may toggle the option of whether the ribbon is seen.

Additional ways of interacting with the ribbon may be used by pressing Alt. Then, the left or right arrows may switch which ribbon tab is active. The down arrow may move the selection lower, so that the left and right arrows start to select an item from the current ribbon tab (instead of choosing a tab). (This was based on Paint from Windows 7.) Once the right item is selected, the button may be “pressed” by pressing Enter (or the space bar... either of those keys will do the same thing). Realizing this, the keyboard controls for working with the ribbon are fairly similar to the way to interact with a traditional CUA-style menu.

Proceeding with Enter

Enter tends to proceed in the following common cases: When filling out a form, enter will press whichever button is selected (with the tab key). If no button is selected, such as if a radio button was just pressed (and the group of radio buttons is the active user interface element), pressing Enter may cause a default button, most often “OK” (perhaps followed by “Search”), to be pressed. On menus, an entry which has been highlighted with the arrow keys may be chosen by pressing the Enter key. If no entry has been chosen, pressing Enter may go ahead and expand a menu. For a selected (highlighted) icon, pressing Enter will generally choose the default action, which is generally to “Open” the icon. To see what the default action is, one may access the context/shortcut menu (by pressing Shift-F10 or by right-clicking) and seeing which menu option shows as bold. One thing to be aware of is that Enter does not typically perform the action of the space bar, which is to change the value of a checkbox or choose a radio button. Pressing Enter when trying to do such things is more likely to press an OK button.

[#usetabky]: Tabbing

(Note, this is about using the tab key. For using the graphical tabs displayed by some software, see: navigating graphical tabs.)

Tab will advance to the next user interface element, such as a button, a form, or a group of radio buttons or checkboxes. Holding shift and pressing tab will cycle through the elements in reverse, choosing another user interface element in the reverse order as the tab key, and this input is oftne used in order to counter an earlier action of pressing tab one too many times by accident.

(Similarly, when using the keyboard for fast task switching, holding Alt and then holding Shift and pressing Tab and, after releasing tab, releasing Shift but still holding Alt is a three-fingered input sequence that also changes which program is selected, but does so in the opposite order of just pressing Tab while the Alt key is held down. Releasing Alt then makes the choice of which program to go to.)

Similar effects (to change selection/focus) may be achieved with F6 or variations of Tab and/or F6: e.g. try Shift-Tab, Ctrl-Tab, Ctrl-Shift-Tab, Shift-F6, Ctrl-F6, Ctrl-Shift-F6, or Alt-F6. For example, Shift-Tab may often move between items in the reverse order as just pressing Tab.


The “Esc” key, called (and, with some types of computers, also labelled as) the “Escape” key, may “back out”, including choosing a “Cancel” button and un-highlighting a menu item (leaving the menu selected) if one was highlighted. This will allow arrow keys to quickly move from menu to menu without the right arrow key being prone to possibly expanding a sub-menu. If a menu is selected but the menu isn't currently expanded, pressing Esc will typically stop interaction with menus, returning the keyboard focus/cursor back to the program's main area. (The way to do that with the mouse may be to click somewhere on a toolbar in between any items on the toolbar, or some other non-impactful location such as a window border, which actually won't resize if the mouse isn't moved as the click occurs, or perhaps the title bar of either a program or a document sub-window.) However, pressing the Esc key may have a couple of other effects, such as backing out of a sub-menu or closing a menu (but leaving the menu selected). Closing a menu, but leaving it selected, allows one to use the arrow keys to choose a menu to display without the right arrow being affected by any sub-menus, and then the desired menu may be opened with a down arrow or an Enter key.

Pressing the Escape key when in the main part of a program (rather than in a menu or child window) may cause the program to display a menu or it may cause the program to close/quit/exit.

Some programs may use Esc as a way to call up a menu or as a an initial key of an “escape sequence”.

In some programs, particularly text/console sessions, holding Ctrl and pressing the left square bracket key (“the [ character”) (and then releasing the Ctrl key) will be equivilent to pressing the Esc key. (This is really no different than the more general concept of using control sequences.)

Selecting with space
After selecting a user interface element with a group of sub-elements, such as a “group” of checkboxes (even if there is actually only one checkbox in the group) or a group of radio buttons, the currently selected sub-element (such as an actual checkbox or radio button) may be “used”/“chosen” by pressing the space bar. To change which sub-element is currently selected, use the arrow keys. Using/choosing a checkbox means to change its status (from checked to fully unchecked, or from fully unchecked to checked, or for the non-binary checkboxes, from semi-filled/checked to fully unchecked). Using/choosing a radio button means to select that radio button and to unselect any other radio button. Keep in mind that, naturally, such a selection is not likely to have any effect until the change is made effective (by choosing an Apply or OK button).
Choosing a button
In addition to the keys that have just been described and which have more common uses (namely Enter and Esc, with Space perhaps acting like Enter in some occasions if the button is selected), some buttons may have an underlined character. If so, holding Alt and pressing that character may choose the button, similar to selecting a menu. (This typically does not just select the item, but proceeds with choosing the item.) The other way to use a button is to select the button (through tabbing) and then to press either the space bar (which sometimes has no effect) or the Enter key (although this will sometimes choose a major button, such as an OK button that closes an entire tabbed window, instead of choosing a button within a minor section of such a window).
Closing programs and sub windows
Closing programs

There are three ways that often work to close a program most quickly. One method is to access the system menu, which may be doable with the keyboard shortcut of Alt-Space. If Alt-Space doesn't work, either access another menu (e.g. Alt-F for File) and press the left arrow key (repeatedly, if needed) to try to select the system menu, or use a pointing device. Once that menu is selected, press a key, usually C for Close, to end the program.

The next most common method is to use Alt-F4. (This has even been known to work in some programs that don't use a typical menu, including Blizzard's expansion pack called “Lord of Destruction” and the older title that was expanded by that expansion pack.)

The next most common may be Alt-F (to access the File menu), and then X (to “Exit”). There may be other methods, although these are likely to be the most commonly supported methods.

Another method may be Alt-F, Q (to access “Quit” from the “File” menu.)

Many text-mode programs may be broken by sending a “break” signal, most commonly by using Ctrl-Break (which may often not work, especially if using a machine remotely) or else with Ctrl-C. The Esc key is also able to back out of, and possibly close, some programs. Text mode programs might also be able to be aborted/terminated (with Ctrl-D in Unix or Ctrl-Z in DOS) or be suspended/backgrounded (with Ctrl-Z in Unix).

Beyond that, the most common way to exit a graphical program with a keyboard may be to use the keyboard to ask the operating system to terminate the program. This may be done by going to a command prompt and using a command to end a program. More details are in the section about adjusting running software. In Microsoft Windows, one may pull up a Task Manager (possibly by using the three finger salute).

On Macs, Command-Q may work to quit. With OSX, holding Option, shift, command, and also Esc for three seconds may “Force Quit” a program.

Closing a sub window

The quick way to close a sub window, which often represents an open document, is to press Ctrl-F4. This keystroke combination comes from an interface standard called “multiple document interface” (“MDI”). Presumably, this is meant to be similar to Alt-F4 to close a program.

The next most common method may be to press Alt-Hyphen, and then c (for “Close”). The precedent for this keystroke combination was meant to be similar to closing a program: With Windows 3.1, a big horizontal bar was used as a program's icon, and this line was menat to be reminiscent of a space bar. So, sub-windows were often shown using a smaller horizontal bar, and so the hyphen key was the easy-to-tap key that typically looked like a horizontal bar on the keyboard.

Another well-known method that commonly works is to use Alt-F (to access the “File” menu), followed by C to close a document.

Other methods may include pressing the Escape key, or other methods that are used to close a parent window. (Typically, a keystroke combination to close a window will not close a parent window if the parent window has an child window that popped up on top of the parent window and is movable independently of the parent window's borders. However, such keystroke combinations will usually close the parent window if the child window is rendered as a dependent window entirely within the outermost borders of the parent window.) Ctrl-W may sometimes work to close a file or to close a window.

With many of these methods, the request is interpreted as being a polite request, and the program may decline to close. By far, the most common reason the program would decline to close is if the program wants to ask whether to save unsaved work before closing the program.

Here, then are some other keys that are often useful.

Pressing F1 may bring up some help. Pressing Shift-F1 may show some context-sensitive help.
Cut, Paste, and Copy

Cutting may typically be done with either Shift-Del or Ctrl-X. The X key is two spots away from the V key and one spot away from the C key on a QWERTY keyboard and one spot away, so the Cut, Ctrl, and Paste keys are next to each other on the QWERTY keyboard layout. One significant exception to this standard is when using the Microsoft Windows File Explorer (more commonly referred to by its modern name of “Windows Explorer”), where Shift-Del will not cut but will delete a file without moving it to the recycle bin.

To paste, Shift-Insert or Ctrl-V work with many programs. Ctrl-V, which is located right next to Ctrl-C (which is often used to “Copy”) when using the QWERTY keyboard layout, may have become more well known than the Common User Access (“CUA”) method of pressing Shift-Insert. Shift-Insert may actually seem more logical since pasting tends to insert, and Ctrl-V was not selected because of any particular word that has the letter V). Despite that, Ctrl-V may be more convenient with some keyboards as the Insert key is one of the keys that is most commonly moved to a non-standard location on keyboard layouts which, often due to having fewer keys due to the keyboard being small, is a non-standard layout.

For copying text, one effective way is often to cut and immediately paste. For example, with the “Common User Access” layout, one may hold the Shift key and press Delete and Insert. The text should return to the state it was before being cut, and a copy is in the clipboard. This may sometimes take longer than choosing an actual copy command, and it may not work with a file explorer that unselects the file after the “Paste” operation is performed. Options include the less well-known Ctrl-Ins (“Control-Insert”), or the more well known Ctrl-C. Note, however, that prior to Ctrl-C becoming well known as a copy command, it was often used as a “break” sequence. For example, batch files may be aborted with either Ctrl-C or Ctrl-Break. This break sequence is still commonly used, due to being friendly to many types of remote terminal emulation, so Ctrl-C may cause some programs, especially “scripts”, to quit.

Selecting a single item
In a list of items (or a group of items, like a directory/folder containing files), pressing the first character of the item's name might select the first item that starts with that letter. Similarly, in an expanded drop-down box, the item might be selectable by pressing the first character of the item's name. If there are multiple items with the same first character, subsequent items may be able to be chosen by either pressing the same first character again (which may cycle through items that start with that letter), or by typing subsequent letters which are part of the name of one or more items. (Those are two different approaches: software will likely only support one of those approaches or the other one, but not both.) Which method is used is not entirely consistent, although the former is likely implemented a bit more frequently. Menus may have a similar interface for selecting a submenu, although if there is only one matching item then the submenu may be not only selected, but also opened.
Selecting multiple items/characters
Holding Ctrl while selecting items with the left mouse button may select multiple items. Holding shift while performing cursor movement operations, such as simply pressing arrow keys, may highlight text. Selecting everything may be performed by going to the first location (being at the beginning of a document or highlighting the first list of files), which may be done with Ctrl-Home (except for Macs), and then holding shift and selecting the “end” (which is the end of the document or the last item in a list of files) by pressing Ctrl-End (again, except for Macs). A quicker way, though, which doesn't require moving a cursor out of its current position (in a document or in a list of files) may often be to simply press Ctrl-A.
Ctrl-Z may undo one operation. Alt-Backspace may undo one operation, although this “Common User Access” standard may be less commonly implemented. Ctrl-Y may redo the last operation that was previously undone but which hasn't yet been redone. In some cases, multiple actions may be able to be undone by pressing Ctrl-Z multiple times. In other cases, such as Microsoft's Notepad.exe, pressing Ctrl-Z an even number of times may simply undo the “Undo” operation from the last time that Ctrl-Z was pressed, making the Ctrl-Z essentially acting like a Redo command (anytime that it is used after an Undo was already performed but before a different undoable action is performed).
Find Next
When editing text, pressing F3 may attempt to find the next occurrance after a previous search was performed (including if the type of search was a “search-and-replace” operation). If a previous search hasn't yet been performed, pressing F3 may be similar to pressing Ctrl-F (to bring up a find box). Note that for searching, the most common key combination (even more than F3) is Ctrl-F to bring up a dialog box to find. If the keyboard focus is on the Find/Search button or the keyboard focus is on the prompt where a person can type text to search for, then pressing Enter may effectively result in performing a “Find Next”. Another possible method to find the next occurrence of text is, while in an interface being used to find text, to use Alt-N. Ctrl-G (which is widely used as the “beep” (“alert”) character, might also be used. (That is a rather sensible option since the letter G is right by the letter F, not only in the alphabet but also on a QWERTY keyboard layout.)
[#nvgfxtab]: Handling graphical tabs
Creating a new tab

Tab handling: Web browsers have started to support tabs. Ctrl-T will typically create a tab, and there is also typically a menu option, on the File menu, to create a “New Tab”. (This functionality is in Firefox, Internet Explorer, and Chrome.)

Navigating tabs
Ctrl-Tab will advance, while Shift-Ctrl-Tab may advance the other way. Note that in at least some versions of Mozilla's Firefox browser, this seems to not work when some web pages have the keyboard focus. Accessing a menu (like with Alt-F) and backing out may help get the keyboard focus out of that window so that Ctrl-Tab will work as expected.
Hold Alt, and then press Tab one or more times. The operating environment will show a representation of the program that will be switched to when the Alt key is released. Pressing Tab (while continuing to hold alt) will select a different application instead. Holding Ctrl (while still holding Alt) and pressing Tab will proceed through choosing the programs in the reverse order that pressing Tab will. Another method may be to use the task manager, which is possibly accessed by using the three-finger salute described below. With Windows Vista and newer, the Flip3D interface will be available when the Aero desktop theme is being used. When that interface is available, holding the Windows button and pressing Tab (or, similar to Alt-, pressing Shift-Tab to go backwards) allows task switching with a different visual display. (When the Flip3D interface is available, the standard Alt-Tab method does still continue to be available.)
Accessing a “Start Menu”
Try pressing Ctrl-Esc. If that doesn't work, some keyboards do have a “Start”, “Menu”, or “Start Menu” button (often showing a “Microsoft Windows” logo) which is located two keys away from the space bar (next to the Alt key which is one key away from the space bar), generally on both sides of the space bar but perhaps only on the left side (particularly for keyboards with fewer keys).
Other system-wide keys

Holding down the menu button (which was a button just described in an earlier paragraph) and pressing keys may cause various effects, especially in modern Microsoft Windows operating systems. Examples include: Menu-R showing a Run dialog box, and Menu-D minimizing all applications (with a subsequent press restoring all applications that were just minimized, although the effect of a subsequent pressing of this combination may differ if some changes are made, like opening new programs). Menu-“Pause/Break” may bring up the “System” control panel applet. There are also some other shortcuts involving this button.

[#thrfngsl]: The three-finger salute

This isn't in any way limited to graphical environments: MS-DOS also supported this.

Alt-Ctrl-Del (more often referred to as Ctrl-Alt-Del) may restart the computer, as it usually does during a POST sequence and in a BIOS setup program and as it usually did when using MS-DOS. With Microsoft Windows, this may bring up a window with some options, such as a way to close programs or other options including opening up the task manager (where programs may be closed), locking the computer, or changing the current user's password. A computer may respond to repeated pressing of this sequence by restarting the computer: this may occur when the sequence is pressed while the operating system is showing a window that was brought up by previously pressing the sequence. This is generally considered to be the best way of restarting a computer if a more preferred way, using software to shut down more cleanly, does not seem to be a working option (either because it is unavailable, as in the case of most MS-DOS sessions, or because there is an option that is usually available but that option just simply isn't working). This is prefered over pressing the reset key because some operating systems may be able to write out any disk cache and perhaps close some file handles, reducing the chances of file system corruption, and some motherboards may be less likely to perform a cold boot technique which may cause some equipment (expansion cards, and perhaps the motherboard) to cause greater wear due to a minor power cycle of the circuitry (even if the computer as a whole isn't being power cycled).

Most technicians, particularly those who are unfamiliar with the phrase “three-finger salute”, may refer to this combination as Ctrl-Alt-Delete, referring to Ctrl being seen first when scanning a QWERTY keyboard from the outside towards the center. The Alt-Ctrl-Del nomenclature refers to Alt being seen first in a left-to-right sweep when using only the keys to the right of the space bar, which may be the preferred Alt and Ctrl keys to use when trying to press all three keys with a single (right) hand.

If a slight rolling motion is made with the right hand in order to perform this sequence and to make sure the Delete key is the last of the three keys being pressed, the Alt key ends up being the first of the three keys that is pressed.

(Performing this single-handedly was a bit easier with 101-key keyboards, before Microsoft promoted the newer 104-key keyboards that showed a Microsoft Windows logo. This is because the older keyboards had a wider space bar and the Alt key was a bit further to the right, and so the Alt key was closer to the Delete key.)

The Ctrl-Alt-Delete order seems to suggest pressing Ctrl first, and that movement is a bit unintuitive when trying to perform the sequence using just the right hand.

In MS-DOS, the same functionality could be obtained by using the numpad period key (which was also labelled as “Del”), even when Num Lock was on (so the key generally generated a period instead of acting like the delete key).

On old Apple II hardware, a similar function was available with “Open Apple-Ctrl-Reset”. “Closed Apple-Ctrl-Reset” (or holding “Open Apple”, “Closed Apple”, and Control while pressing Reset) would perform the system test. The “Ctrl-Reset” would send a “BREAK” signal to a program, which in some cases, including the system test, may have the same effect as “Open Apple-Ctrl-Reset”). Having a joystick plugged in (especially with a button held down) could simulate having the “Closed Apple” The “Closed Apple” key was also known as the “Solid Apple” key.

A BIOS on an old machine (likely older than a 486) has been seen to support pressing Ctrl-Alt-Ins to suspend the computer (even after MS-DOS was fully started) and enter the BIOS setup program. (The BIOS setup program could then be exited and the program resumed.) It is likely this combination was meant to mimic the standard three finger salute.

For further reading on this, see also: the glossary entry for three finger salute, or research the phrase “secure attention key” (“SAK”).

Some other common key functions
The F5 key may re-load a web page and refresh the contents of a folder. This is supported by Microsoft Internet Explorer, Windows (File) Explorer, and Mozilla Firefox. Alternatively, Ctrl-R can also be used to accomplish the same task. To flip from a windowed mode to full-screen, try pressing Alt-Enter (particularly with older graphical operating systems and programs that are designed for a text mode interface) or F11 (which may become a bit more common with graphical programs, including Microsoft Internet Explorer), or variations of F11 (like Shift-F11), or F8 or variations of F8.
Laptop keys
A dual-screen setup is often available, and the laptop may be able to change between showing output on just the internal screen, or just the external screen, or duplicating output on both screens, or treating the screens separately. Look for a key called Fn, located in the bottom row to the left of the space bar. If that exists, then look above the numeric function keys, like F7, and see if there is a drawing of two overlapped boxes (squares or other rectangles). If there is such a drawing above F7, hold Fn and press F7. If the results are not quite what is desired, try again, or try holding Fn and pressing the numeric function key multiple times in a row. If there is no such drawing, try Fn+F7, or if that has no effect, then try (in order) Fn+F5 or Fn+F11 or Fn + other numeric function key. There may be a software program (possibly in the “system tray”/“message notification area”) to make the same sort of change. This change might not work if the video displays are set to use different vertical refresh rates, so if there are settings to adjust that per display then become familiar with the hardware-damaging dangers that display refresh rates could cause and, if safe and possible to proceed, consider making sure all the displays match.
[#cmnusrac]: Common User Access (“CUA”)

Supported by Microsoft Windows. Contains many standards that Microsoft Windows has adopted, such as:

  • Pressing Alt to access menus.
  • Supports the cut/paste sequence of Shift-Delete and Shift-Insert.
    • Also, Ctrl-Insert copies. Although, using cut-and-paste immediately is often so fast and easy that this may often feel like a rather unneeded shortcut which is “just another thing to remember”. Unlike another common standard, of using Ctrl-X for Cut and Ctrl-V for Paste, which has a user needing to pass over the C key on a common QWERTY keyboard layout, CUA's shortcut involves keys that are right next to each other on a standard, full-size keyboard, so cut-and-paste feels even more convenient when using CUA.
  • Is probably responsible for keyboard selection logic (having Shift+movement key sequences causing sections of text to be “selected” (highlighted)).
  • Might also be responsible for Ctrl-Home (jump to top of document) and the similar Ctrl-End (jump to end of document), Ctrl+PgUp (jump cursor to top of page) and the similar Ctrl-PgDown.

However, although this old IBM standard has been implemented by more than just Microsoft Windows, there's been relatively little documentation about the standard to be able to easily confirm some of the nuances regarding what is, and what is not, officially part of the standard.

Some further publications (which may not be freely available) - IEEExplore Digital Library: IBM Systems Application Architecture: Common User Access, and Amazon: System Application Architecture (SAA) CUA Basic Interface Design Guide 1989 Edition (though the photo provided for this book is the companion book in the series, having “Advanced Interface Design Guide” as part of its title). Eventually most people started associating the standard with Microsoft Windows. Its big contribution to history may be people becoming used to overlaid menus, rather than the prior convention, which was for people to use the “function (numeric) keys” (F1 through F12 on a standard 101-key keyboard, although older keyboards may have had fewer such keys and other platforms may have even had more) and keyboard combinations including those keys (such as Ctrl+Shift+F10). MS KB Q110278 documents how Microsoft Word supported keystroke layouts that had been used by an older competitor called WordPerfect.

Some misc notes

These notes may or may not be related to Common User Access (“CUA”).

What does the Apply button do?

The “Interface Hall of Shame” discusses this. Basically, the Apply button is usually very similar to the OK button, except that it does not close the dialog box. It applies all settings, including those that are buried on backgrounded tabs that contain additional settings.

After the “Apply” button is “pressed”, then the “Cancel”will then only cancel changes that were made since the last time changes have been applied with the “Apply” button.

That is, perhaps, the most common behavior. However, some popular program(s) from the late twentieth century were known to act different, so behavior did not seem fully standardized, leading to hesitation or uneasiness by end users.

Some additional terms and/or resources:

[#metakey]: Meta key

Some programs may have documented support for a keystroke combination that involves using the “Meta” key. Just as some programs use ^A or C-A to refer to Ctrl-A, some programs may use M-A to refer to “Meta A”.

Some keyboards actually have a key that was officially called the “meta” key. (The key was typically labelled with a picture of a square rotated 45 degrees, often called a “diamond”. Wikipedia's article for “Meta key” shows a photo.)

Perhaps the program most famous for using the Meta key is Emacs. Other software uses it too, including nano (for some things).

Today, most keyboards do not have a key called Meta, but people can still use their keyboard to perform the same actions that were available by using the Meta key.

  • Many keyboards do have a key labelled as being an Alt key. Holding that, and pressing a key, may implement the Meta key. So, for example, if Meta-X needs to be pressed, holding Alt and pressing x will effectively implement Meta-x. Ergoemacs keyboard shortcuts commentary quotes Emacs documentation as stating, “We refer to <Alt> as <Meta> for historical reasons.”) This approach (using the “Alt” key) is not as compatible in some situations (particularly when using a remote terminal), but may be the fastest method (when it does work).
  • Esc, then key. Since the Alt key is not always supported as well on terminals (perhaps especially remote terminals), another way to enter ASCII code 27, and then press whatever key is desired. In many cases, just pressing the Esc key is the easiest way to enter ASCII code 27. So, if there was a desire to press Meta-x, press the Esc and then X also works to implement Meta-X. (Note: this does not involve holding down the Esc key. Just tap Esc, and then tap the other desired keystroke.)
  • Although the problem seems rare on modern computer setups, the Esc key has been known to not work as expected on some terminals. (This may be something that happened more frequently with older communications hardware and/or software.) However, pressing Ctrl-[ would work just as well as the Esc key. (This ends up just being a case of supporting control keyboard sequences.) This is actually the most likely way to work in multiple environments, although many people have considered this method to be the least convenient.

Calling the key “Meta” may seem a bit user-unfriendly, when the Alt key works just as well. However, the Alt key does not work in as many circumstances. So, using the term “Meta key” is a reference to this standard, and is actually an attempt to be quite user-friendly, by letting people know that different types of computers can easily tap these keystrokes (even if there is no clearly visible Alt key available).

(For further details about pressing keys, see: control keyboard sequences and Interpreting keyboard input. Also, alternate keys is a related topic.)

[#speech]: Speech as an interface
[#txtospch]: Text-to-speech (“TTS”)
Microsoft's Speech Application Programmer's Interface (“Speech API”, “SAPI”)
(Information about multiple versions, and interfaces including using JavaScript)
Voice recognition
Computer interaction
In addition to recognizing words, the intent here is to be able to write out grammer/puctuation/etc.