Aliases With bashrc
Post
Cancel

# Aliases With bashrc

bashrc is a shell script that executes whenever a user logs in via bash terminal. This script can contain configuration settings such as coloring, command aliases, environment variables, etc.
One thing I have started doing is using it to create aliases for commands, so instead of typing out a long command I now just run a short command.
Whenever you edit the bashrc file you would have to reload the file from command line or logout and login again to your bash shell. To circumvent this, one method would be to do the following:

1 alias bashrc='vi ~/.bashrc ; source ~/.bashrc' 

So now whenever you run bashrc, edit the file, exit and wala!

Some useful commands I have added:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 #Mini Python Webserver alias ws='sudo python3 -m http.server 80' #Speedtest alias speed='speedtest-cli' #History alias h='history|grep' #connect to vpns alias vpnh='sudo openvpn ~/VPN/HTB/hackthebox.ovpn' alias vpnt='sudo openvpn ~/VPN/THM/tryhackme.ovpn' #Update system if [ \$UID -ne 0 ]; then alias aptu='sudo apt update ; sudo apt upgrade' alias apti='sudo apt install' alias apts='sudo apt search' fi #get my internet ip alias myip='curl https://ifconfig.io/' #Search alias search='sudo updatedb ; locate'