This assumes that you run ngspice in a terminal window (command window), from a directory containing the netlist shown below with filename "com-emit.net". This netlist is for a simple common emitter amplifier with gain = -Rc/Re.
Looking at the netlist, you will see a 12-volt dc supply V1, and an input signal voltage Vsig that has amplitude 10mV and zero dc offset. There are 5 resistors, 2 capacitors (to couple the signal into and out-of the amplifier), and 1 transistor.
Put the following netlist into a file named "com-emit.net".
* Common emitter amplifier .model 2N3904 NPN(Is=6.734f Xti=3 Eg=1.11 Vaf=74.03 Bf=416.4 Ne=1.259 + Ise=6.734f Ikf=66.78m Xtb=1.5 Br=.7371 Nc=2 Isc=0 Ikr=0 Rc=1 + Cjc=3.638p Mjc=.3085 Vjc=.75 Fc=.5 Cje=4.493p Mje=.2593 + Vje=.75 Tr=239.5n Tf=301.2p Itf=.4 Vtf=4 Xtf=2 Rb=10) * V1 Vcc 0 DC 12V * need extra 0 at "4th" connection of transistors. bug? Q1 vc vb ve 0 2n3904 Rc Vcc vc 2k Re ve 0 500 R1 vb 0 7k R2 Vcc vb 33k C1 Vin vb 0.1u C2 vc Vout 0.1u RL Vout 0 100k Vsig Vin 0 ac 10mV sin(0 10mV 1kHz) .end
In a terminal window (command window), type the following commands. These will run ngspice, using com-emit.net, do a transient response using 1u (1 microsec) stepsize out to 5m (5 millisec), list the variables, plot graphs. The "ac" command will do frequency response from 100 Hz to 100MHz. Note that -vout/vin plots the gain.
..$ ngspice -> source com-emit.net -> tran 1u 5m -> display -> plot vout vin -> ac oct 5 100 100Meg -> plot -vout vin -> plot -vout/vin -> exit