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


MacOS

Find the ip location of MacOS

How to Find Your Mac's Location

Laravel linux

My mobile computer, install Laravel 8 on Sony xperia 5 II

This is my first Android phone. It's no problem to try to install Laravel. Basically, I installed vim and mariadb. After executing sshd, you can log in through 8022, it is completely a mobile computer: p. The software I use is Termux...

linux

Multiple ssh configuration files for public key authentication

When we use ssh public key authentication, we usually add relevant settings in ~/.ssh/config. If some are used by the company or at home, can multiple configs be used? In fact, it is possible. We can use git to load the company-shared, version-controlled config through Include.