How to generate a password with special characters

After Matthias showed me how to generate a password, I wanted to be able to create one with special characters. This way you don’t have to add them later to the password yourself.

I started with pwgen, that you can install in the command line with:

apt-get install pwgen

If you run pwgen, you generate random passwords like:


The passwords are all made up of 8 characters and you get 160 of them at once.

If you want to enforce numbers in the passwords, you type in the command line -n:

pwgen -n

If you want to have at least a capital letter in every password, you type -c:

pwgen -c

If you want to generate completely random passwords, you type -s:

pwgen -s

And if you want to have one with at least one special symbol in every password you choose -y:

pwgen -y

So if you add everything up, if you type:

pwgen -c -n -s -y

you can make your own password from a result like this:

7?|%Wr0! \xXJk7Mp OY=CD@2i !0;I.,\a j2%aFf5: {GIBK4nZ O’_73K>8 P.1@Nm2e
9y(<bG{Z B)db4(H# /iYy”?0) Yc6/OJ/& 5It&=,>8 \n6#F)%N 8+@nljiF M*H5?<nq
#9I4LEk\ S’h-e0Ax 8lEw’v?y w3n,y,iQ FBk$w7or $p^W9[/| #7eA|D8f 2[ACJDv+
q\s.70Do 7!)]}QmA rU!RdIA8 7p@K?3cD 7=/~’Rhe ;{2OCqYn z9>+”N]l 6UYz!]q[
/3UB_{)@ ]_P]8M#4 P]1t0t?# xT~3HzOh :c~A9RA{ %S?X?2cf E7{>uO(_ T)^=1>AX
Q3.Ez!N\ m0M`m3x$ 6WY=z-x2 H’W)$_98 9″V2.+$S xEAv5`~n GR$Zz:|7 |W3AqXHe
gE`rSMU4 fKa*HLs8 &kQ~s0<i eq)U_8.W %|rD6n+S 5XBV’38k ;9(*AMzB ,u’6IU@2
U`G2F`y. hd05BEg? [26T&U#+ dj1&7tdX V+i>:a32 c^.RGNh1 ^U”3XVR[ eZnc!a56
otr2J*0U VQO;{^S4 rd)E\z7I pMn,xHx6 H%`dUu1? 0_<LKv<# f8&Y)U=\ 1D~d|#er
`ylKnp@8 c+CL`/57 sI7J|}_[ z46Vm>9Z !.”rT?q1 {0.}”!Hf i]<-=0Rz Sw&0pB<V
RT4snTs- WEl,35uS g<u?UM7/ :g1c.F”q “&JrK1Cb 88%2#’xJ }Z;”.”2E “b`LI3Q(
,3QH8LW’ 7zU_+\i- 1~!Be-sH nr6!J$R| vp65Ha/H 8Q?&uy#| ‘K/m1NU% 4CB5)(Ln
z@=0tAr# 5S={\|(Z g?o4A<3| =7Azd:AQ Qsl8HE`d Z%-;0Ob3 .N8’fcoI Og_5JB4J
>6feWQ%$ SP1D,7c” N~6N}jmm )q|w7pvI Mpo5=R%X }F2|bnPC q0rN{pAx ;&’,.6iL
~rZ5,,’u alg=Z1y@ +],jk4B3 L+”nfQ5i ]p`7l_O% “-L<6rvz AJ+’3!uW 1bj>Ps}6
[}o1Y8)& cZ12’+={ 4YN[}lKN BjyO\X5l 4rxw|s/U (>QnS&7i 0z(3n>U0 4|=!XC=B
^9v+mP]# >4NzKd8Q x/S3u5G. ‘[I|2*Uw C}2’1Z9r !An2F;s0 `;8ZZ.6R 8!mx>aDH
<N!4un!+ ihg<o2TB 1~’^n@yQ T5WY2kO` A(9|_\iJ C7e_GZLm :0sYS_=s D=nUJ3PN
~72J#}>7 /W!_ZB2\ xZ5E>aA= =F!k\@!0 ./kDOPZ2 ]M|g3x>; )%|,&AY4 HP}V2bg{
_B”^)H)8 (r+{Q&5x 65Tq/*`f q)Ci722] !QATS’$4 zIMIAN7\ 7″7Py93s “xdYe5@<

Leave a Reply

Your email address will not be published. Required fields are marked *