PUNCTUATION is very important on Unix. Provided you use the shell to get things done, you will probably use a lot of punctuative characters in your work.

Many people, however, do not know the terms by which Unix-heads call these characters. Sure, these uses have become diluted over time, but there is a general consensus amongst the Unix types of the world on how to pronounce these characters. This is extremely handy when you are trying to verbally describe a command line or a line of code to one of your peers, as the shorter names for the most common symbols significantly reduce the amount of time you are required to spent talking, which we all know is a significantly ambiguous way to convey information, right?

Let's run across the number row of the keyboard. Of course, various keyboards have different layouts, but I'll try to be fair.

  • ~
    Tilde. No surprises here. Those with sufficiently advanced shells can prefix a user's name with this to specify a directory.
  • `
    Backtick. Shell commands between backticks (See grouping) are executed and their contents replace the expression.
  • !
    Bang! Enough said. ! is often used for logical not.
  • @
    At. Some people call it atsign, but that is (or was) rare - It's a waste of breath, we all know it's a sign. ls uses this character to denote symbolic links (when called with the -F flag) and of course they are in most e-mail addresses. It is also used to specify arrays in perl.
  • #
    Hash. Usually used as a comment, by using it as the first character of a given line in a file. It's almost never called pound.
  • $
    Simply Dollar. See @, above. In shell scripts (and many others including perl) $ is used to reference a variable.
  • %
    Percent. Are we detecting a trend? These days, percent is used mostly for perl hashes, but it was once an important component of many e-mail addresses, mostly people hanging off UUCP nodes.
  • ^
    Caret. Caret isn't used in Unix much, except to show exponents in plain text, and that's not so much Unix as the legacy of USENET, though that did of course come from Unix.
  • &
    Ampersand, because it has a cool name. These days, what with HTML entities like &, it's often called amp. And is not acceptable because you could be typing out the actual word, and we already have a perfectly good name for this character.
  • *
    Splat! My favorite name for any character. Some people call it star and get away with it. In shell globbing, * matches 0 or more of any character. In a regular expression, * is used to indicate that any number of the preceding character will be matched.
  • ( and )
    Generally called open and close (or left and right) paren, respectively. Shell commands inside of () are executed in a subshell and behave like a single command. You can pipe things to the contents of parens:
    tar cf - | ( cd /somelocation ; tar xvf - )
    That is an example of how to efficiently copy a directory using this phenomenon.
  • -
    Dash. Used to specify switches for programs.
  • _
    Underscore. Handy for replacing spaces in filenames, if you get tired of typing \ all the time.
  • +
    Plus. Sometimes used to turn an option off, when - means to turn it on. This is counterintuitive but since - means to activate things, it is the only logical choice.
  • =
    Equal or Equals. It can be said either way. Most commonly used to assign a value to a variable.
  • |
    Pipe. Used to feed the data on STDOUT of the program to its left into the STDIN of the program on the right. The power of Unix is based on the pipe, and redirection in general.
  • \
    Backslash. Backslash is the universal escape character; It makes ordinary characters special, and special characters ordinary. You might even say it toggles specialness. It is itself a special character, so to type a literal backslash you must escape it: \\.

Now the other assorted punctuative keys:

  • [ and ]
    Open and Close (or Left and Right) bracket. Used in C and perl programming (among others) to specify array elements. Used in bourne shell scripting to enclose a test.
  • { and }
    Open and Close (or Left and Right) brace. Also called "curly brackets" if you're just trying to name them collectively, as in the phrase "Surround multiple commands with curly brackets", though "...with braces" is sufficient, correct, and concise. Used in the bourne shell to isolate the name of a variable, to execute multiple commands as if they were a single function, or to group the functions which make up a function. It is used in this latter sense by many programming languages.
  • ;
    The semicolon is known as "sem", "semi", and "semicolon". Used in shells to separate commands, or in several programming languages including C and perl, to designate the end of a line.
  • :
    The colon is simply called "colon". It's used in the bourne shell (and others) to separate elements in a variable, especially the PATH variable. Bourne derivatives sometimes use it for other things; bash uses it to separate shell options (in the SHELLOPTS variable.)
  • '
    The apostrophe is spoken "tick", or referred to as a "tick mark". It is used for a literal quote in many languages including bourne shell scripting, C, and perl, which in general tends to mean that variables and escape sequences within them are not expanded.
  • "
    The double quotes are referred to as "quote". They are used by almost everything for grouping, which is to say that everything between quotes is treated as a single argument.
  • ,
    The comma is just called comma. Elements of lists of all types in shell scripts, perl scripts, C programs and so on are often separated with them.
  • .
    The period is known as "dot". In regular expressions, the dot matches any one character. Prefixing a file name with one will hide it (in most situations) on Unix systems.
  • < and >
    The greater and less than symbols are usually referred to by their long names, "greater than" and "less than" respectively. They are often shortened to "greater" and "less". Among some crowds, they are called "angle brackets", which would appear to be a somewhat newer use. They are used to enclose HTML tags, to redirect input and output (see stdin and stdout) and for the "here" syntax in bourne shell scripting (also borrowed in perl): ">>". "<" is also called "from", and ">" is called "to" or "into", as regards their use in redirection.
  • /
    The forward slash is referred to as "slash", as there is no need to differentiate the slash from the backslash any further than the word "backslash" already provides. Unix uses the slash as the directory separator character.
  • ?
    The question mark is frequently called by its full name. It is also often called "Q-Mark" or even question. In standard shell globbing, it matches any one character and for this reason it is often useful in dealing with files with strange names.


Thanks to: ariels

Log in or register to write something here or to contact authors.