KEuVUe149Y7e320zVKJqOjpo0SGIHzz7ueew9qo8
Bookmark

Bash Aliases : Create Linux Command Line Shortcut

How to make bash aliases on Ubuntu - If you ever wonder how to make shortcut for some Linux commands? Can I do that? Yes, you can easily by making an alias for it.

Creating aliases to use in the command line is a simple way to make linux commands easy to access and simplicity when use the shell. So, you can save the time. The screenshot pic below is result of this tutorial :

1. What is an alias?

How to make bash aliases on Ubuntu

An alias is shortcut for quickly accessing linux commands line. You can specify any name you like for a command. Example if you do not like using 'sudo apt-get update' , you can make it to 'sagu', 'apdet' or whatever you like.

2. How to do that?

The first thing you will need to do if open your .bashrc file located in your home directory. Throw the command below in a terminal:

gedit .bashrc

That command will bring up gedit text editor with bashrc content. Next locate alias definitions. Maybe you will need to uncomment the if statement to activate alias definitions, or just add them directly. Here's the code :

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

Ok! Now create a new file in your home directory, and named it .bash_aliases. Use your favorite text editor to create the new file. In this case use nano. So type and run this command on your terminal :

nano .bash_aliases

It will show you blank file, now start adding aliases. Use this format for adding an alias :

alias [desired alias]='[linux command]'

Example, i want to make apdet to run sudo apt-get update. So it will be like this :

alias apdet='sudo apt-get update'

You also can also add executable script. Here's an example :

alias slavedisk='Desktop/Coded/slavedisk.sh'
alias startwifi='Desktop/Tiwo/startwipi.sh'

I have some Linux commands + Open source graphicaal software Inkscape posts that maybe help you to learn Linux :
  1. Basic Commands of APT-GET and APT-CACHE for Package Management
  2. Basic Linux Commands Most Frequently Used
  3. 26 Useful Linux Terminal Keyboard Shortcuts You Must Know
  4. Inkscape 0.91 Advance Keyboard Shortcuts

And now you can add numerous alias commands to file for your command line happiness. That's all I can write about to make bash aliases on Ubuntu to make linux commands shortcut for quickly access linux command. Hope you've enjoyed reading this tutorial as much I’ve enjoyed writing it. Thanks for visiting us.