LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Blogs > ondoho
User Name
Password

Notices


Rate this Entry

How to use CODE Tags for Code and Command Output

Posted 08-23-2021 at 12:54 AM by ondoho

Let's say you have this output:

$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 789M 2.7M 787M 1% /run
/dev/sda8 9.8G 6.9G 2.5G 74% /

You will notice that the formatting is messed up, it looked much nicer in your terminal!

Instead, you should surround the text with code tags:

[CODE]
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 789M 2.7M 787M 1% /run
/dev/sda8 9.8G 6.9G 2.5G 74% /
[/CODE]

The end result will then look like this:
Code:
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           789M  2.7M  787M   1% /run
/dev/sda8       9.8G  6.9G  2.5G  74% /
This increases readability by a lot for everyone, especially people trying to interpret it for you, so please take this advice seriously.

The tags are case insensitive - you can use [code] bla bla [/code] just as well.

You do not have to type it all out, either: in the advanced post editor you will find this sign: # in the toolbar, clicking it once will output a pair of empty code tags. Try it.

If you have already posted some code without tags, you can go back to the post in question, click the [ Edit ] button (bottom right), and edit your post accordingly.

Thank You.
Posted in Uncategorized
Views 707 Comments 2
« Prev     Main     Next »
Total Comments 2

Comments

  1. Old Comment

    Another way to post info (esp if you can't use copy&paste): |nc termbin.com 9999

    One other way (esp if you "can't" use copy&paste) is:

    |nc termbin.com 9999

    like <some command(s), even cat aFile> | nc termbin.com 9999

    You can look at the website http://termbin.com for more info (9999 is a network 'port')

    You could even combine commands in a subshell, like:
    Code:
    $ (uname -a; df .; sudo inxi -mx; free) | nc termbin.com 9999
    https://termbin.com/uorq
    The info can be seen via the URL returned (expires after a while)

    An example file to `cat` is /var/log/Xorg.0.log

    Also, another way to capture things into a file is the script [filename] command. See: man script

    This blog has info on the "Go Advanced" button (to get the # in the toolbar), and noparse (to display the code tags). The "BB Code" link (at the bottom of posts) documents all tags.

    p.s. note the "Rate this (blog) Entry" at top enables us to give ondoho the 5stars they deserve
    Posted 09-01-2021 at 05:41 PM by GentleThotSeaMonkey GentleThotSeaMonkey is offline
    Updated 09-01-2021 at 11:58 PM by GentleThotSeaMonkey
  2. Old Comment
    /dev/disk/by-id/usb-WD_Elements_2621_57583832454130415945334D-0:0 /mnt/usb-WD_Elements_2621_57583832454130415945334D-0:0 auto nosuid,nodev,nofail,x-gvfs-show 0 0
    Posted 07-15-2022 at 03:54 AM by piotrbujakowski piotrbujakowski is offline
 

  



All times are GMT -5. The time now is 04:17 PM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration