Basic commands of linux

Hey Guys !!!! Here, I am up with another blog on Linux basic commands.
Let us start by discussing what is Linux, its importance and why it is important to know the basics of Linux?
Linux is an open source operating system(OS). It is a free and open source operating system. What makes Linux different from other operating system is that unlike windows which a proprietary operating system which means users have to work in the relatively closed environment. There are various flavors of Linux which are listed below:

  • Ubuntu Linux
  • Red Hat Enterprise Linux
  • Linux Mint
  • Debian
  • Fedora

Linux is mostly used in a server(there are various reasons for using them for a server because they are fast, free and most importantly secure). Linux has completely open source kernel(kernel is basically the central part of an operating system).  Windows server costs very high.
Linux has a bit of learning curve, however, patience and perseverance will lead to be an expert in Linux. Here are some basic Linux commands that one should know:
1. ls: This command is used to list down the files in the directory you are in. The ls-a command can be used to list down all the hidden files.
2. cd: This command is used to change the directory.
3. mkdir & rmdir: mkdir is used to create a folder or a directory using a command prompt. For example, if you want to make a directory named “techdenovo”, then by using the command mkdir techdenovo you can make a new folder named techdenovo.
 4. cp: cp simply stands for a copy. This command is used to copy the files or a group of files. This command requires at least two file name in its arguments. The syntax of cp command is as follows:

  •          cp source destination
  •          cp source directory
  1. When you want to copy multiple files use the command below:
  •           cp source_1 source_2 source_n directory 

5. rm: This command is used to delete the files or directory. But the turning point comes here that the rm command cannot be directly used to remove directories. Instead, we use recursive(-R or -r) option to remove all the content of a directory along with the directory itself.
6. man & –help: Man command provides you a helping hand. Man command gives you more information about a command. It gives you a detailed information about a command(opens a manual page of a given command). The page then gives all the relevant information about that command like its name, synopsis, description etc.
7. touch: This command is used to create a new and empty file. It is also used to modify dates and time of most recent access and modification on existing files.
8. mv: This command is used to move files using a command line. We can also use this command to rename files and directories. The syntax for moving the file and renaming is given below:
[code language=”bash”]
mv [options] [-T] source destination                (for renaming a file)
mv [options] source [source2 …] destination      (for moving a file)
[/code]
 9. locate:  The locate utility works better and faster than it’s find counterpart because instead of searching the file system when a file search is initiated – Something find does – locate would look through a database. This database contains bits and parts of files and their corresponding paths on your system.
[code language=”bash”]locate index.html -n 20[/code]
 10. cat:  cat is one of the most frequently used commands. It has three related functions with regard to text files: displaying them, combining copies of them and creating new ones.
[code language=”bash”]
cat [options] [filenames] [-] [filenames]
[/code]
Example
[code language=”bash”]
cat file1 > file2
[/code]
 11. echo: The echo program displays text. It’s a handy way to create customized output in your terminal.
[code language=”bash”]
echo –version
or
x=10
echo The value of variable x = $x
[/code]
 12. uname: The uname command within Linux allows you to view system information about your Linux environment. Here’s how to use uname effectively.
[code language=”bash”]
uname -a
[/code]
 13. apt-get: Ubuntu is derived from Debian Linux. And Debian uses dpkg packaging system. A packaging system is a way to provide programs and applications for installation. APT (Advanced Package Tool) is the command line tool to interact with this packaging system.
apt-get is for installing, upgrading and cleaning packages
[code language=”bash”]
sudo apt-get update
[/code]
 14. chmod: This command is used to change the mode of a file or directories. It is used to change the permission granted by Linux to an executable file or directories. An example of the same is as follows:
[code language=”bash”]
Syntax
chmod options permissions file name
[/code]
Example
Let’s say you are the owner of a file named myfile, and you want to set its permissions so that:
the user can read, write, ande xecute it;
members of your group can read ande xecute it; and
others may only read it.
This command will do the trick:
[code language=”bash”]
chmod u=rwx,g=rx,o=r myfile
[/code]
Each digit is a combination of the numbers 4, 2, 1, and 0:
4 stands for “read”,
2 stands for “write”,
1 stands for “execute”, and
0 stands for “no permission.”
[code language=”bash”]
chmod 754 myfile
[/code]
 15. ping: Ping command is used to check the connection to the server. For example, if you do ping techdenovo.com, you get the following results. This command checks whether techdenovo.com gets connected and comes back. This command inspects the round-trip time and displays the results as follows. You can basically use this command to check your internet connectivity. If you ping a particular server (it can be any of the server google.com or yahoo,.com or anything), then it confirms that your internet connection is active.
Some basic tips for using Linux commands:

  •  Use Ctrl+C or Ctrl+Z to terminate any command safely. Firstly, use Ctrl+C and if it doesn’t stop with that then go for Ctrl+Z.
  •  You can use clear command to clear the terminal if it is filled up with commands.
  •  Use the exit command to exit from the terminal.
What is Elastic IP in AWS

What is Elastic IP in AWS ?
AWS EC2 instances are computing services that can be used to host web services and applications. These instances belong to an Amazon virtual cloud and they can be accessed with the help of IPs in your specified range.
Amazon EC2 instances serves with two types of external IPs – Public IP and Elastic IP.
When a new EC2 instance is started, it will be automatically assigned a public IP to access that instance. This public IP address can be used to access the EC2 instance from outside. However this public IP changes on every subsequent EC2 reboot.  As a result, services in that instance that use DNS, can face downtime during this change in IP.  So to counter or eliminate this issue of downtime of DNS service, Elastic IP is introduced.  Elastic IPs (EIPs) are static IPs allocated to a specific AWS account. They are public IPv4 addresses, that can be manually assigned to EC2 instances to access them from outside. The elastic IPs are static in nature and does not change with an instance restart. Their static nature makes EIPs a more preferable option for services in EC2 instances.

Here are some benefits of using elastic IPs, which prompts us to prefer them over public IPs for our customers’ EC2 instances.

  1. Static and public – Being static in nature, we use the Elastic IPs for public services that require static IPs – such as web server, dns or email server.
  2. Flexibility – As Elastic IPs are allotted to each AWS account and are not specific to an EC2 instance, we allocate an Elastic IP to any EC2 instance as and when a requirement arise.
  3. Load balancing – When one EC2 instance fails or gets overloaded with traffic, we allocate its associated EIP to another EC2 instance, by configuring a failover setup in the system. This helps us to ensure uninterrupted service for the users.
  4. Fail-over setup – Having multiple Elastic IPs for an AWS account enables us to quickly map a service from one IP to another, in case of issues such as IP blacklisting or IP changes.
  5. Uptime – With our load balancing and fail-over setup with the help of elastic IPs, we are able to prevent downtime in services that can happen due to maintenance or DNS propagation.
What are cookies?

Hello, guys hope you are having an amazing day. I am here with another blog on a cookie. Yes, you read correctly cookie. Being in the computer world you might have heard of this word “cookie” now and then. So what exactly is this cookie? Where is this term used? And what is its significance in the tech world? Having a lot of questions in your mind? In this blog, I am going to discuss all these things in detail. By reading this whole blog, you will definitely be able to know and clearly, understand what these cookies are.
A cookie is basically text files that website store in browser about you, what you browse what you like or your preferences (your language, website name, your interests), it can also be what you have clicked on.
Now you guys might think that why are these data stored.

How website use your cookie?
Have you ever wondered that if you have logged in on a shopping website and add something to your shopping cart why you see the same items in your shopping cart even after you have closed the website, it gives you the same basket? The reason behind this is the website stores your cart information as a cookie on your browser so next time when you come upon the same website next time, it serves you the same basket again. Also, it is shown as a recommendation on another website.
Let us take the second example, about your login information. The first time when you log in to any website, it stores the cookie on the website with all your login details. So next time when you visit the same website, it recognizes you. But if you clear your cookies or even if it expires, the website refuses to recognize you. Sadly, in such cases, you need to login to the website again.
Language example:  Your preferred language gets stored as cookies in your browser so next time when you visit the website it remembers the language you preferred and serves you the website in that preferred language itself. Sounds pretty good right? A cookie is not just limited to shopping cart or your preferred language. It can contain many different types of information like all the links of a website that you visited from a certain website or how many times you visited a website.
Cookies are used for marketing purposes. If you look something on the internet your cookies can be stored and next time when you browse another website, these stored cookies can be used to display ads or relevant content on the website you are browsing.
Cookies also have an expiry date. It depends on various factors and also varies from cookies to cookies.
Now the question comes up on whether these cookies are good or bad?
It totally depends on your perspective and how you feel about companies storing your information and utilizing them.
Cookies can pretty much save your time when it comes to the items added to your shopping cart. You don’t need to search the items and add to the cart again.
It also saves your time by saving your login details by preventing you to login by entering your credentials again and again.
Generally, cookies do not affect your privacy. You can clear your cookie history or prevent them from being stored by clearing the cache or you can change the setting by disabling them from being stored.

How much is a limit of storage of cookies?

Pics

  1. How cookies look like
  2. Variation of msgs in a browser

Hope you guys like this blog and also hope that this blog has solved all your queries and questions related to a cookie. Still, if you have any queries or any questions let me know in the comment section. If you want me to explain any topic of your choice tells me in the comment section.
Keep

Git commands and Github

In the previous blog, you have gone through Git and its purpose and also about github.
In this blog, I shall take you through the journey of git commands and how the existing source code is pushed to remote web repository.
here are few git commands which we shall look into in details
git init //only for a first time
git add . // only when files to be added for stagging
git commit -m “your meaningful message”
git remote add origin <url>
git push origin master
The following two commands are being used for one time while setting up the git environment in your laptop/desktop
git config –global user.email “your@email.com”
git config –global user.name “your name”
–global (is used to make sure that the user.email and user.name is available everywhere within the system)
Below are the steps(along with screenshots ) u need to follow for pushing your source code to GitHub.
Step 1. here we create a new directory/folder using mkdir command.

Step 2. using cd command, we moved to the newrepo folder.

Step 3. Using git init command, we initialized the newrepo folder as git repository.

Step 4. We created or copied two files inside the newrepo folder. Using ls command, we can list the files inside the folder.

Step 5. Using git add . command, we added the files inside the newrepo folder for staging.
Step 6. git status command shows the staged files which have been added.

Step 7. Using git commit -m “techdenovo and techdenovo_images files added” command, we saved the state of the stage containing the files.

Step 8.  Next, we goto the URL of GitHub  (https://github.com) and log into the GitHub dashboard and create a new repository.

Step 9. The remote(GitHub) repository name should be same as the local repository name.

Step 10. We choose Public access to the repository and create the repository.

Step 11. Since we already have our existing repository, we shall only use “git remote add origin https://github.com/kalyan4github/newrepo.git ” and “git push – u origin master” in the git bash.

Step 12. “git remote add origin https://github.com/kalyan4github/newrepo.git” command is used to link the local repository to the remote repository and giving the URL (https://github.com/kalyan4github/newrepo.git) a name of “origin”.

Step 13. Then we use “git push -u origin master” command to push our source codes to GitHub remote repository. It will prompt for GitHub username:

If you are doing this for the very first time, you will have to use git config command and then commit the changes as follows:

Step 14. As soon as the username is entered, it will prompt for a password.

Step 15. Entering correct credentials will start the push process.

Step 16. Then we goto the GitHub repository (newrepo) and verify the Source code we have pushed.

In the upcoming blog, I shall cover topics related to git which will show the collaboration of developers within the same repository. Also, stay tuned for the video blog of this article.

What is Git and GitHub?

Hey, guys, a new blog is up!!!! Being in the computer science field you have to come across the name git/GitHub. (Some of you might have even know the term but might be confused). As it seems to be a very big and complicated term, but it is as simple as ABC. The only thing is that you need to be clear about the concepts and this blog definitely will clear all your concepts regarding git and will clear all your concepts related to git.
Let us start with the simple yet basic introduction, What is Git and why we need Git?
You might have come across the statement that “Git is a version management system”. Now the question comes that what is a version management system?
Let me explain you by a simple example. Imagine you are working on a big scale application with a couple of your colleague each one of them are working on a different feature, for example, someone working on login feature, other working with the APIs and yet other one working on some other management system. In the end, you want to merge out each and every feature. Here comes the role of Git.
Also, imagine a situation that while working on the same application, you thought of adding a feature lets say the API related feature. But something wrong happened and the things did not go the way they should have gone and everything just got messed up. Now you wish to if you could get back to the old code and the things could be reversed back. And again version control system comes here to give you a helping hand. To restore your application to a certain stage where it was working completely fine here comes Git. This can be done by committing your application(my next blog would contain more about what is committing and other important terms related to Git, this is just the introductory blog on Git).
You can also use Git for showcasing your work to the employer so that he/she can check out the works you have done, what kind of code you have written, or what are the projects or applications you have worked on or have built, what languages you know. You can send your profile to anybody by pushing it into Github. Not all of you guys might like your work to be public and viewed by all the people around there. Also, you may not want people to see your work when you will be working on a big application for a company or even for yourself, then you can go with the private part of GitHub(various paid schemes are available will discuss it in the later section).
Now comes another important point that most of you guys might think that if you want to work with GitHub, the only way to do that is with the terminal(black screen which sometimes seems to be weird, a lot of you might think of it as a nightmare when it comes to using of terminal). Here, you have another option. You can use GUI based application provided by GitHub for various windows, mac os, Linux (I personally prefer to use a terminal, I am not biased towards any of them but I have a higher opinion for using terminal).
It doesn’t matter which platform you are using to communicate with GitHub. You just need to know the basic steps of pushing, committing and pulling the code.
I won’t be discussing the commands that we will be using for pushing our code on Github. This will be discussed in another blog (link to the blog: https://www.techdenovo.com/git-and-its-commands-and-github/).
Now let us dive into the what is GitHub?

GitHub is a platform which allows you to do the above-mentioned things. Github keeps a record of everyone’s contribution when you are working with multiple people. Also, it does keep a record of the version of the code you uploaded. (or in a simple sense it tracks the changes you have made while building your application)
Let me make you guys familiar with the terms repository, branch and issues.
A repository is a centralized storage which stores your data or source code files. A repository makes possible for many developers from remote locations to work together using a repository.
Issues are a discussion on threads where people can report bugs, ask questions or request some new features.
Suppose that you are working on an application and you have released 1st version of the same. Your client is using the application. Now he wants you to add some other feature to the same application but simultaneously he also wants to continue using the application till you complete the new feature. In such a case you need a dedicated place to experiment so that none of the changes you made affects the old version of the application before you are done with it. And hence you create a branch of the code, it is an alternate timeline where you can safely make the changes to your application without affecting other users.
In my next blog, I will be talking more on git, on GUI based application that Git provides and various packages that Git provides.

Convertion of AWS generated key file pem to ppk to be used in putty

In this blog, I shall show you how to convert your AWS generated SSH pem key file to ppk.
First, need to download the putty.zip from the http://putty.org

Extract the content and open PUTTYGEN.EXE file

It will ask for the security warning, just run the file.

Next, load the downloaded pem file by click on the load file.

Navigate to the path of the pem file and select the file.

 
The pem file loads and displays the public key pair content and the fringerprint key

Then next from the conversions menu, select the Export OpenSSH key, it will save the pem file private key in ppk format to be used via putty.

It will ask for the confirmation to save the file without a passphrase, select yes as option as while connecting to EC2 instance via putty, we dont want a passphrase prompt.

Just let’s give the file name and save the file in ppk format.

Now we can use the ppk file via putty, in the upcoming blog, I shall show the use of putty and use the private key and connect to EC2 instance. Happy blogging