How to Do a Straight Vertical Line on a Keyboard

Techwalla may earn compensation through affiliate links in this story.
Image Credit: Geber86/E+/GettyImages

You can type a straight vertical line, or "|," on most modern keyboards dating back to some of the 1980s IBM PCs. It's generally found above the backslash, so you can type a "|" by holding down the shift key and hitting the "" key.

The | Symbol

The | symbol can be used for a variety of functions, including programming and shell scripting in Unix systems and representing the absolute value symbol in mathematical equations. It can also be used if you simply need to draw a straight vertical line for visual purposes to break up text or as part of an emoticon.

It's generally found on a standard keyboard above the backslash key. If you're using a smart phone to type, you may have to go into a "symbols" submenu to find the | symbol.

Many people call the symbol "pipe."

How It's Used

A straight vertical line can be used in mathematics to represent the absolute value of a number, meaning its distance from zero. For example, the absolute value of -5, written |-5|, is simply 5. The absolute value of positive 5, or |5|, is also 5.

You can think of the absolute value as removing the negative sign from a number if it has one.

The symbol is also used in programming and shell scripting on Unix-style systems, including macOS and Linux. It's used to feed the output of one program into another.

For example, the command "ls -1" will list the files in the current folder one to a line on most Unix systems. The command "sort" prints its output in alphabetically sorted order. You can run "ls -1 | sort" to send the output of the "ls -1" command to the "sort" command and get the list of files in sorted order. You can assemble more complex chains of piped output, sometimes called pipelines, between multiple programs.

The symbol "|" also has other meanings in other programming languages. In some languages, it refers to an "or" operation. Often, a single "|" refers to a bitwise or, an operation on the binary representation of two numbers, while a "||" refers to a logical or, a statement that's true if either of its subparts are true.

In the database language SQL, "||" is used to join two strings of text.

Other Ways to Write |

If you have a keyboard without a "|" symbol, never fear. There are other ways to enter it into a document or file.

You can search for it in the Character Map utility on Windows or the "Emoji & Symbols" menu on macOS. Alternatively, you can search for the symbol in another document or through a Google or Bing search, then copy and paste it into your document.

references