Quoting commands

command line

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?

Best Answer

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.

Related Question