by Devin Yang
(This article was automatically translated.)

Published - 7 years ago ( Updated - 7 years ago )

~/.bashrc on Linux or ~/.bash on MacOS

Test on the terminal (just paste it on the terminal and execute it):
env LC_CTYPE=C tr -dc A-Za-z0-9_ < /dev/urandom | head -c "16" | xargs
If the shell you use is bash, you can add it to ./bash_profile as follows:
alias gpw='genpasswd'
genpasswd() {
env LC_CTYPE=C tr -dc A-Za-z0-9_ < /dev/urandom | head -c "16" | xargs
}
Remember to update source ~/.bash_profile take effect.
Then we only need to enter gpw to generate a set of random passwords.
password-generator

Tags: linux mac

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


linux

How to check apache loaded and enabled which modules?

How to check apache loaded and enabled which modules?

linux,config

Ubuntu ppp0 renamed eth0

Not sure who will use it, but I encountered it myself, because my home is a floating IP. A software I installed cannot detect that the ppp0 network card is an external network, so changing the name can trick him into successfully installing it.

linux, mac, terminal, tips

How to clear the input of the current command line on the terminal of Linux or Mac?

How to clear the current command line in Linux or Mac terminal? For example, if you typed a bunch of instructions wrongly, and you want to clear them, Be sure to do the same as I used to, use the reverse key to kill slowly, we can use...