# Listings settings for command line arguments [closed]

I am typesetting a set of instructions which includes several (Unix) command line arguments. I have been using the listings package to include these arguments, but the colouring is less than ideal. Weird words like "test" are bolded. Is there something more like Pygments, which can highlight flags and filenames and the like?

As an example something like

program-name -some-option-flag -some-other-option-flag -i /location/of/input/file -o /location/of/output/file

• Would you please provide an example of what you're doing? Nov 9, 2011 at 17:32
• @Dave: You can use the package minted which uses pygments. Nov 9, 2011 at 17:49
• It is possible to specify the language used in a listing, and even define your own language or formatting. As suggested, provide an MWE to allow others to work with something.
– Werner
Nov 9, 2011 at 18:43
• Thanks for providing the command line that you are tying to typeset, but it would be even more helpful to have a complete MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. That way we can see exactly what the problem is. Nov 9, 2011 at 23:53

Without a full MWE it not clear exactly what issue you are having. But, you can define you own keywords that you want highlighted. Below I have defined cd, man, ls,and uptime to be emphasized in blue, and the keyword filename to be emphasized in red. So when these appear in the listing the specified formatting is applied.

\documentclass{article}
\usepackage{listings}%
\usepackage{xcolor}

\lstset{%
backgroundcolor=\color{yellow!20},%
basicstyle=\small\ttfamily,%
numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt,%
}%

\lstset{emph={%
cd, man, ls,uptime%
},emphstyle={\color{blue}\bfseries\underbar},%
morekeywords={filename},
keywordstyle={\color{red}\ttfamily}
}%

\begin{document}
\begin{lstlisting}
man cd
ls -lF test/
rm filename
uptime
\end{lstlisting}
\end{document}