Introduction to Linux and the CLI.
This article provides a basic knowledge that a developer needs to start building using Linux and CLI.
Linux code isn't hard to learn if you have some basic tech knowledge and an understanding of operating systems. If you're an analytical and logical thinker, it will be easy to learn basic commands and syntax. Even if you're a tech newbie, you can still learn Linux. One reason for learning Linux is that much of the infrastructure that powers the internet, including routers and servers, is based on Linux.
Introduction
Being a developer, keeping yourself updated with all the latest technologies coming up daily is an important and integral part of the job. Similarly, we have different Operating Systems for developing software depending on the developer's usage and preference. Linux, macOS, and Windows are highly preferred operating systems. Although, Windows has an additional advantage as it allows developers to work simultaneously with Windows and Linux. Using these two Operating Systems allows web developers to use the necessary apps including Node JS, Ubuntu, and GIT.
Linux provides encryption and hence has powerful network security. Due to this, it is a highly secure and reliable OS. Also, the updates don't interrupt the developer's workflow. It is super user-friendly, well-designed, and convenient. However, if you are thinking of getting into programming or web development, a Linux distro (such as Ubuntu, CentOS, and Debian) is the best Operating System to start with.
What is Linux?
Like every other Operating System, Linux is one of the most popular operating systems. It's a family of open-source Unix-like operating systems based on the Linux Kernal, an OS kernel first released on September 17, 1991, by Linus Torvalds.
Distros
There are so many distros of Linux that do different things, and some of them are very specialized in what sorts of things they can accomplish. I'm going to only introduce you primarily to one through this blog, Ubuntu(ubuntu.com), but that's not to say there aren't many good reasons to choose other ones.
Why are we choosing Ubuntu? It's a very good choice for many different use cases. It's a downstream distro of Debian where downstream means that Ubuntu builds upon the base of Debian. Ubuntu has a nice interface distro of Linux which I think is the easiest to use.
You can also have a look at a few other popular distros:
Running Linux
Installing and running a distro is not that tough, if you're using a desktop running Linux of some sort, you are already set unless you are too curious and want to know how to get up and running on Windows and macOS.
Virtualization
We're going to run our Linux through a process called virtualization and will be running a virtual machine which is frequently abbreviated as VMs. VMs are operating system running within another operating system, called the host machine. The host machine will create a virtual environment with virtual access to its hardware to the VM. The VM will have no idea that it's not running on real hardware; all it can see is the resources that the host is providing it.
For either macOS or Windows: Multipass
Multipass(multipass.run) is a great new tool from the folks at Canonical (who make Ubuntu). It's a super easy way to spin up and spin down little VMs to try things out. You can even spin up multiple and play with them together. I'd recommend this for most users of macOS and Windows since it just sort of works without a lot of effort and you don't have to install everything yourself.
If you are on Windows 10 Home you need to install VirtualBox too in addition to Multipass. Multipass will use VirtualBox if it can't use Microsoft Hyper-V (a feature only available in Windows 10 Pro.) If you are on macOS or Windows 10 Pro, you do not need VirtualBox.
Once you have Multipass installed, you should be able to run it and open a new shell. For Mac users, it'll drop a little orange icon on your command board at the top. For Windows, it's in your system tray.
For either macOS or Windows: VirtualBox
Oracle makes a product called VirtualBox. VirtualBox is a hosted hypervisor which is another way of saying that this is a program that allows you to run VMs. It can run Windows, Linux, macOS, and many other VMs but today all we care about is Linux.
What's annoying is that you’ll need VirtualBox and the Ubuntu Server installation. It’s possible, just will take some time.
For creating the VM, just create a new Ubuntu 64-bit VM with all default options. When you go to start it for the first time, it'll ask you to choose a boot media file. Point it at the Ubuntu 18.04 .iso file you downloaded. From here, just follow the instructions to install Ubuntu. Give it a username and password. This doesn't need to be super secure so just it is a username and password you can remember. For everything else, just follow the menus and give the default responses. You don't need to connect to GitHub or anything, nor do you need any additional packages installed.
It will ask you to restart after you install so do that. Once done, you should be able to start your VM and login into your new shell with the username and password you created.
For Windows users: WSL
If you're a Windows 10 user, you can install and use WSL. It allows you to run Linux natively inside Windows. It allows you to run Linux natively inside Windows. I won't walk you through it but I'll leave the doc here if you're keen on going down that path:
Basics of CLI command
As of now, you have a Linux command line open and ready to go.
A command-line interface (CLI) is a text-based user interface (UI) used to run programs, manage computer files and interact with the computer. Command-line interfaces are also called command-line user interfaces, console user interfaces and character user interfaces. Using detailed commands through a command-line interface can be faster and more efficient than scrolling across GUI tabs and dialogs.
What you're looking at is often called a REPL, a Read Evaluate Print Loop. It's an interactive way of programming where you're writing one line of code at a time, feeding data in and out of little programs. Using commands here, you can navigate around your computer, read and write data, make network calls, and all sorts of other stuff. Most anything you can do with a desktop you can do with a command line, it's just a little less obvious how to do it.
Shells and Emulators
The first thing we should do is get some terminology out of the way. You are using a shell right now, and that shell is almost certainly called bash(it is unless you changed something), the Bourne Again Shell (which is making fun of the Bourne shell which bashes replaced.) It's by far the most common shell and is over 30 years old.
A shell is a user interface for access to an operating system's services. Most often the user interacts with the shell using a command-line interface (CLI). Terminals are named shell because it is the outermost layer around the operating system. The terminal is a program that opens a graphical window and lets you interact with the shell.
There are other shells and we'll talk more about them later, the most common of which are zsh, ash, PowerShell, and cmd.exe.
Conclusion
In this article, we have just scratched the surface of Linux and CLI. If you enjoyed learning and find it useful please do like and share so that, it reaches others as well 🤝.
Thanks for reading 😃
I would ❤ to connect with you on Twitter | LinkedIn | GitHub Let me know in the comment section if you have any doubts or feedback.