-
-
Save caseyamcl/53f0c91e9ef1b42abb57 to your computer and use it in GitHub Desktop.
Linux CLI Password Generator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Need to generate passwords frequently on the Linux CLI? | |
# | |
# This script creates a password and copies it to the clipboard. | |
# | |
# 1. Ensure you have 'pwgen' and 'xclip' installed | |
# (sudo apt-get install pwgen xclip) | |
# 2. Download this script and make it executable: | |
# (sudo wget -O /usr/bin/pw https://gist.githubusercontent.com/caseyamcl/53f0c91e9ef1b42abb57/raw/pw && sudo chmod 755 /usr/bin/pw) | |
# | |
PW=`pwgen 16 1` | |
GR='\e[0;32m' # Green | |
NC='\e[0m' # No Color | |
echo -n $PW | xclip -i -selection clipboard | |
echo -e "\nGenerated password '${GR}$PW${NC}' and copied it to the clipboard\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment