# Drawing Realistic Linux Command Shell Windows with tcolorbox

}
\newcommand{\SU}[1]{\pgfkeys{/ubuntu/.cd,#1}%
\gdef\MyUbuntuPrompt{\textcolor{\MyUbuntuColor}{\small\ttfamily\bfseries \MyUbuntuUser@\MyUbuntuHost{\textcolor{white}:}\textcolor{cyan!60}{\url{~}}{\textcolor{white}\MyUbuntuPromptChar} }}}
\newcommand{\StartConsole}{\gdef\MyUbuntuPrompt{}}

\SU{user=root,host=ubuntu,color=lime}
\begin{ubuntu}
whoami \StartConsole
root \SU{root}
id \StartConsole
uid=0(root) gid=0(root) groups=0(root)\SU{root}
hostname \StartConsole
ubuntu\SU{root}
ssh cat@burrow\StartConsole
bob@remotehost's\ password:
Linux remotehost 2.6.32-5-686 #1 SMP Sun Sep 23 09:49:36 UTC 2012 i686
You have mail.
Last login: Wed Oct 16 01:12:35 2012 from localhost
\SU{cat}
whoami\StartConsole
schroedingers_cat\SU{cat}
_
\end{ubuntu}

\end{document}


The penguin must have seen the many occurrences of the word "Ubuntu" here.

• I did try to explain what I did but I am lacking fundamental information on what you do not understand in the explanation. This is a recurring problem, and there is a nice video explaining it. All I can say is that \ corresponds to a carriage return and \hspace*{-\Lind} undoes the indent because \hspace generates some space but if its argument is negative it undoes it. I will be happy to explain differently if I know what part of my explanation you have trouble with.
– user194703
Nov 25, 2019 at 22:04
• @voices \setbox0\hbox{<something>} is a standard trick to measure the width of something. So I measure the width and store it in a dimension that I called \Lind for no special reason, you could use \IdontknowhowIwanttocallthislength instead. \the\dimexpr allows us to add lengths, which I used to increase the length by 1pt. The argument is just copied from every listing line` because the font information does alter the width.
– user194703
Nov 25, 2019 at 22:40
• @voices At some level, these are very good analogies except for \hspace, which inserts a space that is given by its argument. (I am only on my cell phone now.)
– user194703
Nov 26, 2019 at 2:40
• @voices I added a version using pgf keys which simplifies things IMO.
– user194703
Nov 27, 2019 at 5:16
• @voices I added a way to change the prompt char to the lowest example.
– user194703
Nov 28, 2019 at 19:30