1

How do I format any system commands or system messages correctly as in

sudo apt-get update

I see that kind of codes with a grey background and I understood earlier that such things have to be formatted alike. However, I can't find how to make them appear like that. Could somebody tell me how to manage? "Ctrl+K" does not work.

6
  • Are you talking about the Markdown used in questions and answers in AskUbuntu?
    – FedKad
    Commented Jun 16 at 10:37
  • 1
    If for formatting here, see code block
    – muru
    Commented Jun 16 at 11:27
  • 2
    Does this answer your question? How to edit to look like code?
    – muru
    Commented Jun 16 at 12:27
  • Do you mean "how do I format inline code" such as this (as it's explained in the answer linked by muru)? Or do you mean "how do I add syntax highlighting to code blocks"?
    – kos
    Commented Jun 17 at 2:29
  • 1
    Note that this question was posted on the main site but someone edited it to fix the format leading to this very confusing situation where the OP looks like they are asking how to do what they have already done. The original version of the question, as written by the OP, wasn't formatted as you see here.
    – terdon
    Commented Jun 17 at 16:18
  • @terdon Now it makes more sense, I rolled back to OP's original version (minus the "Thanks" and adding the newline they were missing to separate the citation from the following text, so that now reading the description it should be clear what they're asking
    – kos
    Commented Jun 17 at 18:35

1 Answer 1

1

For individual commands you wrap them in backticks `like this` this would give you a way to inline a command inside another block of text. There's a few ways to do code blocks. I favour the 'github' style code fence these days where you

```
Wrap
some
code
```

To get something like

Wrap
some
code

You can also use the classic 4 spaces in front of a line to

get
the
same
result

this is what the {} in the editor menu does.

If you see some formatting you're unaware of, hitting the 'edit' option on any post will show it in markdown so you can see what's done.

1
  • 2
    Regular posts and comments have different subsets of markdown. Only the inline code blocks will work in comments Commented Jun 17 at 14:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .