Back to articles
January 15, 2025

Linux command line Password Generator

use apg to create passwords on the CLI

alias mkpsswd='apg -s -a 1 -m 32 -n 4'

apg command line help

   apg  [-a  algorithm]  [-M  mode]  [-E char_string] [-n num_of_pass] [-m
   min_pass_len] [-x max_pass_len]  [-r  dictfile]  [-b  filter_file]  [-p
   min_substr_len] [-s] [-c cl_seed] [-d] [-y] [-l] [-t] [-q] [-h] [-v]

       apg -a 0 -M sncl -n 6 -x 10 -m 8 (new style)

If you want to generate really secure passwords, you should use option -s.

To simplify apg usage, you can write a small shell script. For example:

 
  #!/bin/sh
  /usr/local/bin/apg -m 8 -x 12 -s
Loading comments...