Command Line

Display a command line with a prompt and, optionally, the output/response from the commands.

How to use

This is intended for code blocks (<pre><code>) and not for inline code.

Add class command-line to your <pre>. For a server command line, specify the user and host names using the data-user and data-host attributes. The resulting prompt displays a # for the root user and $ for all other users. For any other command line, such as a Windows prompt, you may specify the entire prompt using the data-prompt attribute.

Optional: You may specify the lines to be presented as output (no prompt and no highlighting) through the data-output attribute on the <pre> element in the following simple format:

Examples:

5
The 5th line
1-5
Lines 1 through 5
1,4
Line 1 and line 4
1-2, 5, 9-20
Lines 1 through 2, line 5, lines 9 through 20

Optional: To automatically present some lines as output, you can prefix those lines with any string and specify the prefix using the data-filter-output attribute on the <pre> element. For example, data-filter-output="(out)" will treat lines beginning with (out) as output and remove the prefix.

Examples

Root User Without Output

cd /usr/local/etc
cp php.ini php.ini.bak
vi php.ini

Non-Root User With Output

pwd
/usr/home/chris/bin
ls -la
total 2
drwxr-xr-x   2 chris  chris     11 Jan 10 16:48 .
drwxr--r-x  45 chris  chris     92 Feb 14 11:10 ..
-rwxr-xr-x   1 chris  chris    444 Aug 25  2013 backup
-rwxr-xr-x   1 chris  chris    642 Jan 17 14:42 deploy

Windows PowerShell With Output

dir


    Directory: C:\Users\Chris


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
d-r--        10/14/2015   5:06 PM            Contacts
d-r--        12/12/2015   1:47 PM            Desktop
d-r--         11/4/2015   7:59 PM            Documents
d-r--        10/14/2015   5:06 PM            Downloads
d-r--        10/14/2015   5:06 PM            Favorites
d-r--        10/14/2015   5:06 PM            Links
d-r--        10/14/2015   5:06 PM            Music
d-r--        10/14/2015   5:06 PM            Pictures
d-r--        10/14/2015   5:06 PM            Saved Games
d-r--        10/14/2015   5:06 PM            Searches
d-r--        10/14/2015   5:06 PM            Videos