.bashrc and permanent aliases

Today I came through a concept called aliases in linux. It was pretty interesting topic. An alias is a command that is user-defined built from other commands. For eg, you could build an alias by,

$ alias aliasName=’command1; command2;’

After that you could enter this alias name in the terminal to execute the commands in chain.

.bashrc is a hidden file which is located in your home directory. Some linux based operating systems have them by default, but sometime they are not created by default. If not already present, then you can create it yourself. But remember to create it in the home directory. ‘.bashrc’ is a shell script that is automatically executed by terminal session, whenever it is started. ‘.bashrc’ file allows you to create permanent aliases.

The problem with alias is that they are temporary by default, means aliases will only execute for one terminal session in which it was created. If you create an alias and close the terminal, and then you opened a new terminal session, the previous alias you created won’t work in the new terminal session.

So inorder to solve this problem we need to create permanent alias. For creating permanent alias, simply copy your alias command and paste it into the .bashrc file. So each time you open a new terminal session, the .bashrc file will create your alias for you.


Links are awesome !

While reading a book on linux ( The linux command line ), I came through the concept of links. There are two types of links in linux, hard link and symbolic link. The latter was created to overcome the limitations of the former.

Hard links

The hardlinks was the method adopted by the earlier linux versions. It was the original way of creating a link in linux. Every file will have a filename, by default this filename is attached to the file using a hardlink, therefore every file has a hardlink by default. Now coming to the limitations of hardlink.

  • Hardlinks cannot reference a file outside it’s own filesystem.

  • They cannot reference a directory.

A hardlink can be created by using the following command.

$ ln file linkname

A hardlink can be removed by using the following command.

$ unlink linkname

Now the awesome part of the links is that whenever you make any changes to content of the link, it is automatically applied to the file.

Symbolic links

The symbolic links allows you to create links to the directories as well. Also it allow you to create a link that can reference a file outside it’s own filesystem.

A symlink can be created by using the following command.

$ ln -s <directory/file> linkname

A symlink can be removed by using the following command.

$ unlink linkname

Avoid the hassle of git authentication

Git as you all know is a version control system created by Linus Torwalds. Linus Torwalds is the creator of the linux OS. He created git for easing the development of linux kernel. A version control system is a software that keeps tracks of all the version s of a file. Different versions of a file are generated when changes are made to the particular file.

I came to use git recently, when i started developing miniproject for my BTECH course. I am pretty noob to git. But with my limited knowledge of git I am able to perform basic operations of git. I have an account in github.com which is a website i use to store my repositories. Each time I do a git push to my origin master I need to perform authentication with the github.com server. This gradually got boring because each time I push, I need to enter my username and password.

But git has a feature that could avoid this boring process of authentication each time. This feature of git can be enabled by entering the following commands in the command line.


$ git config credential.helper store

$ git push https://github.com/<username>/<repoName.git>

$ Username : <type your username>

$ Password : <type your password>


After you perform the above commands, you can push to your repository without authenticating each time. The ‘credential.helper store’ allows you to store the username and password in .git-credentials file as plaint text. Most developer tell this method is inefficient, but I find it useful.

For more reference on the topic, visit https://git-scm.com/docs/git-credential-store

#! /bin/bash

Shell programing

Being a linux user, you may be familiar with terminals. Terminals are used to enter commands that could perform some functions. In windows, there is something called batch programs that allow you to execute the windows cmd commands one by one. Shell programming allow you to create script files that are programs on their own. These scripts can execute a chain of commands. Shell programming also allow you to use normal programming constructs like for, while, if etc..

Shell is basically an interface between us and unix kernal. It converts the commands we enter into something the kernal could understand. Kernal is what that manages resources in our linux OS. Most of linux operating system provide it’s users with a shell program from the GNU project called the ‘bash’. The bash is the acronym for ‘bourne again shell’. For the graphical user interface, there is another program called the terminal emulator which is supplied for interaction with the shell.