How to create a bash alias that can take arguments.

Posted: September 24, 2017. At: 3:19 PM. This was 3 months ago. Post ID: 11394
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

This bash alias will take a directory name or path as an argument.

alias goto='cd $1'

This is an example of how this alias works.

[email protected]:~$ goto /usr/share

This is a very neat bash trick. This might not work if the directory name uses spaces though.

Generate a very complex password with the Linux command line.

echo; head -5 /dev/urandom | tr -d -c '[:alnum:]' ; echo

Just read from /dev/urandom an filter out anything that is not a letter or number. This still creates a very secure password.

No comments have been made. Use this form to start the conversation :)

Leave a Reply