Author: Sahil Suri

4 ways to identify your current shell (if it’s bash)

Introduction Knowing which run you are using on your system is an important piece of information. Your shell determines your login environment to a large extent as it controls which environment variables get exported, your shell prompt etc. On a Linux system it’s almost certain that you will using the bash shell unless the system administrator has deliberately changed it to something else. In this quick article we will demonstrate four ways you can determines if you are running the bash shell or not.   Method 1: Use the BASH environment variable If you are currently using the bash shell then the BASH environment variable will contain the path of the bash shell installed on your system. If you are using a different shell then this variable will be empty. Let’s try this on the command line. [root@nclient ~]# echo $BASH /bin/bash The above output shows the path where bash is installed on my system. Now let’s change the shell and then try again. [root@linuxnix ~]# zsh [root@linuxnix]~# echo $BASH [root@linuxnix]~# When I changed my shell to zsh and then checked the value of the variable $BASH it came out to be empty indicative of the fact that I’m no longer running the bash shell.   Method 2: use the SHELL environment variable The SHELL environment variable contains the path of the shell that is set when you log...

Read More

Fixing git/github merge conflicts

Introduction In our previous article on the git version control system, we explained how we could modify our files in repositories in our GitHub account and then pull the changes from GitHub to the git repositories on our local system and keep the files in synchronization. Now, what if we modified the same piece of information in a file on GitHub as well as within our local git repository? In this article, we will demonstrate how we would proceed if we modified the same information in a file on GitHub as well as locally within our git repository. Git allows any number of parties to work on the same file at the same time independently of one another. To demonstrate we’ll be using a Perl script named hello.pl available in my local git repository under the folder /home/sahil/perl_scripts_for_training. Given below are the contents of the script. [sahil@linuxnix perl_scripts_for_training]$ pwd /home/sahil/perl_scripts_for_training [sahil@linuxnix perl_scripts_for_training]$ cat hello.pl #!/usr/bin/perl -w ###################################### #Author: Sahil Suri #Date: 24/03/2018 #Purpose: Hello World in Perl #version: v1.0 ###################################### print "Hello World\n"; print "Hello World again\n" [sahil@linuxnix perl_scripts_for_training]$ I’ve modified the script in my local repository such that it has the following content now: [sahil@linuxnix perl_scripts_for_training]$ cat hello.pl #!/usr/bin/perl -w ###################################### #Author: Sahil Suri #Date: 24/03/2018 #Purpose: Hello World in Perl #version: v1.0 ###################################### print "Hello World\n"; print "Hello World again.\nI'm Sahil\n" When we execute the script we...

Read More

Pulling changes from GitHub to Git

Introduction In our previous article, we demonstrated how we would push our git repositories from our local system out to GitHub. In this article, we will demonstrate how we would actually make changes in a file within a repository on GitHub and then pull the changes/updates to our local machine.   Demonstration: I’ll continue to use the git repository perl_scripts_for_training that we had created and pushed to GitHub in our previous article. From among the files present in that repository, we’ll select a file named say.pl. To select the file we simply need to click on its name and the file will be opened in GitHub. This will open the file in GitHub as shown in the below screenshot: On the right-hand corner of the window where the file has been opened, we can see a couple of tabs. If we click on the Raw tab then GitHub will open the file in text format on the browser. If we click on Blame then GitHub will show us a history of users or contributors who’ve collaborated on the file. This is helpful in determining which user made what modifications to the file. If we click on History then that would open a history of changes/updates made to the file.  This is similar to the type of output we see using the git log command on the command line but...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.