They offer different flash templates with latest features.
Login

Forgot password
Register
Back
Written by:
crismblog
Score: 19
votes: 23
Format: Article

 Use alias to create shortcuts for commands


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:

  • alias shortcut-command="regular-command"

For example:

  • alias install="sudo apt-get install"
  • alias monitoroff="xset dpms force off"
  • alias poweroff="sudo shutdown -h now"

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:

  • install package1 package2

Tags: alias for commands, sortcuts for commands, create shortcuts for commands, create alias for commands
Created: 6 years ago.
Last edited: 6 years ago.
Reviewed: 6 years ago.


Comments
3 years ago

roxymarks
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
. ~/.bash_aliases
fi

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"):
source ~/.bashrc
 
4 years ago

jahid_0903014
one command! makes things so simple! great....  
5 years ago

russellz
Some suggestions for frequently used commands:
alias cd..='cd ..'
alias cp='cp -i'
alias d='ls'
alias df='df -h -x supermount'
alias du='du -h'
alias egrep='egrep --color'
alias fgrep='fgrep --color'
alias grep='grep --color'
alias l='ls'
alias la='ls -a'
alias ll='ls -l'
alias ls='ls -F --color=auto'
alias lsd='ls -d */'
alias md='mkdir'
alias mv='mv -i'
alias p='cd -'
alias rd='rmdir'
alias rm='rm -i'
 
5 years ago

IDex
Very good, simple and to the point.  
6 years ago

yves910
Thanks, a newbie.  

Other tutorials from crismblog