Backslash Definition

The backslash is an upward-to-the-left sloping straight line character that is used mostly in a computer context.

Its main use in Unix-like operating systems and in some programming languages (e.g., C and Perl) is as an escape character, that is, to indicate that the following character has a special meaning. For example, a backslash followed by a lower case letter n (i.e., \n) represents a new line and a backslash followed by a lower case t (i.e., \t) represents a tab. Such sequences are referred to as escape sequences.

Another application is in the TeX typesetting system, used on Unix-like operating systems, in which the backslash is used to represent the start of a markup tag. Also, in some text editors a backslash appears at the end of each line that wraps around to the next line.

For most people, however, the most familiar use of the backslash is as a separator for directory names and file names in MS-DOS and the various Microsoft Windows operating systems. This role is similar to the use of the forward slash (i.e., a straight line sloping upward to the right) in Unix-like operating systems and the Internet.

However, the forward slash has an additional role in Unix-like operating systems of representing the root directory (i.e., the directory that contains all other directories). Microsoft operating systems generally do not have a single root directory and thus cannot use the backslash for this purpose.

The backslash was selected as the path delimiter in some early operating systems because the forward slash had already been in use to designate command-line options. However, options were designated by hyphens in the original UNIX. and thus in all of its descendants; consequently, forward slashes were the logical choice for directory and file separators.

Created September 5, 2005.
Copyright © 2005 The Linux Information Project. All Rights Reserved.