10 years ago
The average linux users use the terminal commands for many tasks and some certain commands are very frequently used. For example, if you are a user of Ubuntu, you have to type " sudo apt-get install" every time you want to install a new package or the command "xset dpms force off" to turn off the desktop/laptop monitor. To save time, you can create shortcuts for these commands by adding aliases into the bash configuration file (~/.bashrc or /etc/bash.bashrc). The syntax to use aliases is:
After adding these lines into the bash configuration file and log out and log in again, you can use the new aliases. For example, to install new packages, you can use the following command after you used the above aliases:
In Ubuntu ~/.bashrc checks if ~/.bash_aliases file exists, so it's nice to add aliases to ~/.bash_aliases instead. Or you can just add
if [ -f ~/.bash_aliases ]; then
You don't need to logout and login after changing the aliases, just do (can also use a dot (.) instead of "source", as "." is an alias for "source"):
one command! makes things so simple! great....
Some suggestions for frequently used commands:
alias cd..='cd ..'
alias cp='cp -i'
alias df='df -h -x supermount'
alias du='du -h'
alias egrep='egrep --color'
alias fgrep='fgrep --color'
alias grep='grep --color'
alias la='ls -a'
alias ll='ls -l'
alias ls='ls -F --color=auto'
alias lsd='ls -d */'
alias mv='mv -i'
alias p='cd -'
alias rm='rm -i'
Very good, simple and to the point.
Thanks, a newbie.