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.

• Can you explain what you did? I see you added escapeinside=||, which is obvious, but i've never used these guys: \newlength{\Lind} \setbox0\hbox{\small\ttfamily\bfseries root@} \setlength{\Lind}{\the\dimexpr\wd0+1pt} \newcommand{\LR}{\\\hspace*{-\Lind}}. I mean, I can see what you've done and why in a broad sense (simply escaping \newline & \\ ` seems to leave indents & extra whitespace), but I don't understand how it works. Rather than just copying you blindly, it would be valuable to know the details so I can learn to solve this kind of problem on my own next time. – voices Nov 25 '19 at 21:55
• @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.) – Schrödinger's cat Nov 26 '19 at 2:40
• @voices Yes. There is a simple trick: you can just change the prompt on the fly. I wrote an answer for that. – Schrödinger's cat Nov 27 '19 at 4:09
• @voices I added a version using pgf keys which simplifies things IMO. – Schrödinger's cat Nov 27 '19 at 5:16
• @voices I added a way to change the prompt char to the lowest example. – Schrödinger's cat Nov 28 '19 at 19:30