How to create a bash alias that can take arguments.

Posted: September 24, 2017. At: 3:19 PM. This was 3 weeks ago. Post ID: 11394

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
jason@jason-desktop:/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