Developer Essentials: Demystifying Linux & Git

Ushasri Mavuri
Crio-IBelieveinDoing
6 min readSep 15, 2020
IBelieveinDoing

One fine day I received a mail stating that another edition named #IBelieveinDoing bootcamp has started in which one can learn basic linux terminal commands and git.

Attending crio.do Bootcamp is an intense experience; I spend 2 days fully immersed learning new concepts like Linux, git, and terminal.

Finally registered and joined in the slack group where I met with a lot of techies.

I attended the kickoff call hosted by Sridhar sir and Kiran sir, they discussed the following content…

Why is Linux a must-know tool for professional developers?

What is the true potential of Linux?

How to get rid of the fear of the terminal?

How to get most out of the Linux, Git Bytes?

If you wanted to watch the recorded session, then go through the video

After the kickoff session, we got the tasks/challenges. We learn and finished our tasks in Crio platform exercises named as Bytes.

Our Tasks are :

  1. Start with basic navigation commands, then move on to files, scripts, and the process. Learn more about system resources and networking to get a deeper understanding of what you can do with LinuxByte.
  2. With the GitByte, get your hands on git operations and commands using both command line and Gitlab.
  3. (Optional)Linux intermediate

Why Linux?

A majority of systems around the world run some form of Linux. These range from enterprise and desktop servers to smartphones.

  • 60 to 70% of all Web Servers in the world run some form of Linux/Unix and ~90% of all cloud computing happens on Linux based servers.
  • Most of the smartphones in the world run on Linux.
  • Mac is based on Unix and supports a terminal where these commands can be run.
Get started with the Linux terminal & begin using terminal commands

90% of public cloud computing services run Linux. A competent software developer must know how to use a Linux system comfortably. When you create your own Linux virtual machine from services like GCloud, AWS, or Microsoft Azure, you don’t usually get access to a Graphical User Interface (GUI). You have to use the Linux terminal to operate and manage your server.

The Linux file explorer as seen in the GUI

Can you examine the screenshot of a file explorer window above!

The present working directory is Documents.

The immediate parent directory is the users Home directory (Note: Home is a special directory. We will learn more about this later).

There is one file: important.txt and two sub-directories: Personal and Work.

important.txt has the largest size (the others have size = 0 bytes since they are directories).

Personal and Work have the same last modified time, however, important.txt appears to have been modified most recently.

1. pwd

Use the command to print the working directory.

2. ls

To list the contents of a directory, you use the command (short for list). When you run the command without any arguments, it lists the contents of the present working directory by default.

3. cd

You can change to a different directory using the cd command (short for change directory).

Note:

If you don’t provide any argument to the cd command, it defaults to the user’s home directory. The ls command defaults to the present working directory.

There is a symbol to denote a user’s home directory. The tilde (~) sign.

cd ~ will take you to your home directory.

ls ~ will list the contents of your home directory.

File System

Let us understand the naming convention above mentioned:

Absolute Path:

In the Linux terminal, there is always more than one way to do the same thing. Below are some options to display the contents of /var.

Irrespective of the present working directory, you can run cd /var to take you to /var. Similarly, ls /var can be executed from any working directory and it will always display the contents of /var.

This is called using the absolute path where we provided the full path to a directory right from the root of the filesystem: **/**.

Relative Path:

Relative paths are relative to the present working directory. A list of special relative paths are listed in the table below and additional examples are in the code block that follows.

Manipulating file permissions:

Linux file permissions

As the image tells us, r means permission to read data from a file, w means permission to write/edit a file & x means permission to execute a file.

Why GIT?

Git is the most commonly used version control system. Git tracks the changes you make to files, so you have a record of what has been done, and you can revert to specific versions should you ever need to. Git also makes collaboration easier, allowing changes by multiple people to all to be merged into one source.

What is the difference between git and git bash?

Git Bash and Git Shell are two different command-line programs that allow you to interface with the underlying git program. Bash is a Linux-based command line while Shell is a native Windows command line.

A few Operations & Commands

Some of the basic operations in Git are:

  1. Init: git init creates an empty Git repository or re-initializes an existing one. It creates a .git directory with subdirectories and template files. Running a git init in an existing repository will not overwrite things that are already there. It rather picks up the newly added templates.
  2. Add: This command updates the index using the current content found in the working tree and then prepares the content in the staging area for the next commit.
  3. Commit: It refers to recording snapshots of the repository at a given time. Committed snapshots will never change unless done explicitly. Let me explain how commit works with the diagram below:
  4. Pull: The git pull command fetches changes from a remote repository to a local repository. It merges upstream changes in your local repository, which is a common task in Git-based collaborations.
  5. Push: This command transfer commits from your local repository to your remote repository. It is the opposite of a pull operation. Pulling imports commits to local repositories whereas pushing exports commits to the remote repositories.

Some advanced Git operations are:

Branching: Branches in Git are nothing but pointers to a specific commit. Git generally prefers to keep its branches as lightweight as possible.

There are two types of branches local branches and remote-tracking branches.

Merging: Merging is the way to combine the work of different branches. This will allow us to branch off, develop a new feature, and then combine it back in.

Rebasing: This is also a way of combining the work between different branches. Rebasing takes a set of commits, copies them, and stores them outside your repository.

A basic overview of how Git works:

  • Create a “repository” (project) with a git hosting tool (like Bitbucket)
  • Copy (or clone) the repository to your local machine
  • Add a file to your local repo and “commit” (save) the changes
  • “Push” your changes to your master branch
  • Make a change to your file with a git hosting tool and commit
  • “Pull” the changes to your local machine
  • Create a “branch” (version), make a change, commit the change
  • Open a “pull request”.
  • “Merge” your branch to the master branch.

You can refer to this Git Cheatsheet:

“OK, What’s Next?”

Are you excited to learn something!!!!

Would you like to join the Crio Community! then click here.

Get started with Bytes and Micro-Experiences:)

I’m attaching some Bytes for u:)

Linux Basics 1https://learn.crio.do/home/me/ME_LINUX1

Linux Basics 2https://learn.crio.do/home/me/ME_LINUX2

Git Basicshttps://learn.crio.do/home/me/ME_GIT_BASICS

--

--