By Sheldon L | Published at 2019-11-14 | Updated at 2020-04-29 |
~/.bashrc
~/.bashrc
is defining a path’s shortcut, environment PATH
, and some preprocessing before a shell runs:# add a path shortcut
export PathName=/user_dir
# add a sub path shortcut under a parent path
export SubPathName=$ParentPathName/sub_dir
# add a new path to system's `PATH` (also called `environment variable`) after installing a software
export PATH=/dir_of_a_new_software_bin:$PATH # must be named `PATH`
# restart terminal
~/.bash_aliases
alias
, or can be a block start with function, and quoted with {}
# can be a single line start with `alias`
alias sthstart='systemctl start sth'
alias la='ls -a'
# or can be a block start with function, and quoted with `{}`
function apt-updater {
sudo apt update
sudo apt upgrade -Vy
sudo apt autoremove -y
sudo apt autoclean
sudo apt clean
}
function v2-LA {
sudo cp /dir/jsonfile /etc/v2ray/config.json
sudo systemctl restart v2ray
systemctl status v2ray
}
function quickpush {
git add .
git commit -m 'default quick push'
git push
}
# restart terminal
unalias [alia]
: unset the offending alias.~/.bash_profile
~/.bashrc
is temporarily environment PATH
, you should manually start it with source ./bash_profile
everytime you want to use these PATH
s.# add to `~/.bash_profile`
export PATH=/dir_of_a_new_software_bin:$PATH
# run manually
source ./bash_profile
export HISTCONTROL=ignoredups
export HISTIGNORE="&:ls:[bf]g:exit:history"
export HISTTIMEFORMAT='%F %T '