I have defined two listings environments, one for Python and other for Bash, both have different settings, this is a minimal example of what i'm using:
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{xcolor}
% Some definitions to use color
% Default fixed font does not support bold face
\DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{9} % for bold
\DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{9} % for normal
% Custom colors
\usepackage{color}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\usepackage{listings}
% Python style for highlighting
\newcommand\pythonstyle{\lstset{
language=Python,
basicstyle=\footnotesize,
otherkeywords={self},
tabsize=1,
keywordstyle=\ttb\color{deepblue},
emph={__init__, update_port},
emphstyle=\ttb\color{deepred},
stringstyle=\ttb\color{deepgreen},
frame=single,
showstringspaces=false,
float=htpb,
numbers=left,
captionpos=b,
numbersep=5pt,
linewidth=0.95\linewidth,
xleftmargin=0.05\linewidth,
breaklines=true
breakwhitespace=false,
}}
% Python environment
\lstnewenvironment{python}[1][]
{
\pythonstyle
\lstset{#1}
}
{}
% Bash style for highlighting
\newcommand\bashstyle{
\lstset{
language=bash,
keywordstyle=\sffamily\ttm,
basicstyle=\sffamily\ttm,
numbersep=5pt,
frame=tb,
columns=fullflexible,
backgroundcolor=\color{yellow!20},
linewidth=0.95\linewidth,
xleftmargin=0.05\linewidth,
breaklines=true,
captionpos=b
}}
% Bash environment
\lstnewenvironment{bash}[1][]
{
\bashstyle
\lstset{#1}
}
{}
\begin{document}
\lstlistoflistings
\section{test}
\begin{python}[caption=python example]
class MyClass(Yourclass):
def __init__(self, my, yours):
bla = '5 1 2 3 4'
print bla
\end{python}
\begin{bash}[caption=bash example]
$ sudo yum update -y
$ sudo yum install -y https://rdo.fedorapeople.org/rdo-release.rpm
$ sudo yum install packstack
\end{bash}
\end{document}
The result is like this:
As we can see both fall under the same Listings, however it is desirable to have two different listings for both of this styles, they should have separate lists, with separate index names and separate numbering. For example i should have a "Python code 1: python example" and one "bash code 1: bash example", i should also have a list of python codes and a list of bash codes.
Is it possible to do it? If so how can it be done?
Edited to be more clear.

\lstdefinestyle{custom}. Have you tried to create two new environments based on the listing environment ? – Jérôme Dequeker Feb 29 '16 at 14:10\DeclareFixedFont; just say\renewcommand{\ttdefault}{txtt}and thenbasicstyle=\small\ttfamily. Then your usage of\ttbcan simply become\bfseries– egreg Mar 01 '16 at 08:39