Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

As I've learned to use Linux over the years, I've repeatedly come across the idiom of quoting commands with a leading backtick (`) and a following single quote ('), like so:

`rm -rf /tmp/foo/bar'

(I first realized that I kept seeing this, I think, on jwz's site. I might have even asked him this question, though that would have been a loooong time ago.)

Is there a significance to this style of quoting commands? I do it myself, now, so that if people just copy and paste what I've posted, and don't know enough to leave out the marks, the command will fail.

Is there a preferred method for making commands like mysql -hlocalhost -u -p -A bigdatabase obvious in running text, without offsetting it in its own paragraph as above?

share|improve this question
    
You can escape commands as "code" with backticks i.e. `mysql -h localhost -u -p -A bigdatabase` (see unix.stackexchange.com/editing-help). The link for that guide is at the top right of the answer box. –  Thomas Sep 15 '10 at 2:24
add comment

3 Answers

up vote 6 down vote accepted

I haven't actually witnessed exactly what you're talking about as a widespread phenomenon, but I can think of three hypotheses, in increasing order of likelihood.

  1. In Bash and similar shells/scripting languages, backticks can be used for command substitution; people may be referring to that. (But here there are backticks on both sides.)

  2. In markdown syntax, applicable even here on Stack Exchange sites, backticks are used to put things in a monospaced/typewriter font: like this, which typically is used to indicate that something is a short piece of code or something you'd enter into a command line interface. (But again, here, there are backticks on both sides.)

  3. In LaTeX mark-up, which is likely something disproportionally used by linuxers/Unixers, backticks are used as left quotation marks and single quotes for right quotation marks, so `this' becomes ‘this’ when typeset. Perhaps this is why this a common practice among linux/Unixers.

I guess there might be other explanations, but I personally haven't really witnessed this phenomenon much.

share|improve this answer
3  
I actually think the third is the reason. I know this is very common on a couple IRC channels I'm in, and it's because of LaTeX –  Michael Mrozek Sep 15 '10 at 2:33
    
Just noticed another case, in Rails error messages, like: "#<NoMethodError: undefined method `invokable_worker_methods' for...". –  David Krider Sep 15 '10 at 16:56
1  
Number 3 is often seen in man pages and error messages. –  Dennis Williamson Sep 16 '10 at 1:58
add comment

Good typography demands that the opening and closing quote glyphs be different (and symmetrical). Some older computer fonts (e.g., Sun console) provided left- and right- quote glyphs on the backtick and apostrophe characters; modern fonts tend to show he grave accent and a vertical single quote instead. Unicode now provides separate characters for left- and right- quotes.

You can read the full story, including Unicode code points for all involved characters and a history of the backtick+apostrophe convention, at: http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

Whether the use of backtick+apostrophe makes visual sense is all about fonts: TeX/LaTeX fonts indeed interpret backtick and apostrophe as left- and right- quote glyphs; the use of backtick+apostrophe for quoting is still commonplace in (ASCII-format) Emacs and TeXinfo documentation.

I personally tend to adapt my quoting habits to the context very much:

  • when a markup language is used (e.g., markdown here on SE sites), I use whatever markup syntax for monospaced font;

  • when writing plain ASCII text, I tend to avoid using backticks as they have a special meaning to the shell and use single- or double- quotes to enclose command snippets. (Same quote character at both sides.)

  • when writing LaTeX or Emacs docs, I use the backtick+apostrophe convention.

share|improve this answer
add comment

I think that what you are seeing is just "correct" typography. There is software out there, such as smartypants, that automatically convert plain text punctuation into HTML entities.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.