You can usually start with Linux without even going through the process of installing it. There are plenty of cloud providers (Google Cloud, Microsoft Azure, AWS) that offer free plans with preinstalled Linux instance on their hardware so you just have to open account with them and you will get remote access to Linux command line. Linux command line is called shell and while there are different shells you can use the most common is Bash. So let’s see what you can do with it from the perspective of Linux beginner.
As a Linux beginner you probably read about many different Linux distributions. The most known are Ubuntu, Fedora, Arch, Debian, CentOS, Red Hat, SUSE, Slackware, Mint, MX and many more. Actually they are all forks of some of the major distributions like Debian and Red Hat. But what’s more important for this tutorial they all share same basic commands so form the beginners perspective it really doesn’t matter which Linux distribution you choose.
I’m not going into details on how to register account with cloud provider because each provider is a bit different and they offer pretty good documentation on how to get an account and how to access your Linux instance command line.
Moreover each provider requires credit card details but won’t charge you for a free plan. However you need to read carefully what’s included in free plan. Usually it’s time limitation for free plan but keep in mind that most of the providers will start charging you once you spend what’s included in free plan. So have your account plan dashboard and statistics open and check it frequently to be sure you’re still using free plan resources.
Ok, let’s suppose you are now logged in and Linux command line is in front of you. There are two major types of user accounts in Linux, administrator user and basic user. Administrator user (usually called root) have full access to all system resources which means it can access and change all files, it can install and update system wide hardware and software. Administrator accounts have hash tag (#) in the command prompt like this: root#. Basic user can access and change only it’s own files which are usually stored in home directory (/home/user/). The command prompt for basic user ends with dollar sign ($) and looks like this: user$. Even if you have administrator user credentials the rule of thumb is to use it only for system software installations and configurations and for normal everyday use basic user.
As you probably know one of the main concepts of any operation system is file system. File system from the user perspective is quite simple, there are files and directories. Files are pieces of data (text, images, videos, executables, etc) with name and access permissions. Directories in basic terms are file containers so you can logically group files into different containers (directories). Directories also have names and access permissions.
There are many commands for working with files and directories.
Let’s start with ls, which is short for list files and directories. If you type this command in command prompt and press enter you will get list of all files and directories on your current path. But what does mean current path and path anyway?
In terms of any operating system, file system is made of many files and directories. Directories can contain other directories (and files as well). So path means position of a file in relation to some other file or directory. For example top directory in Linux file system is represented with /. To check your current path you can use command pwd.
Now suppose you would like to create new directory for your projects. You can do this with command mkdir projects, mkdir is short for make directory. The most Linux commands have meaningful names and are easy to remember. To remove directory you can use rmdir but directory needs to be empty, meaning you first need to delete everything inside (files and other directories).
Then you will usually position yourself inside that directory with command cd projects, cd is short for change directory. In directory structure two dots (..) are representing parent directory, so if you want to “exit” projects directory you can type cd ... Don’t forget to use ls to check directory content. Most commands have additional options you can pass to command to modify their behavior. To see what additional options you can use with some command type command with option -h or –help, for example ls –help.
For deleting files (and directories too) use rm command (short for remove) and then name of the file, for example rm some-file. For details on its many operators type rm –help. There is additional help and documentation on each command you can invoke by using man command, which is short for manual. For additional help on rm command you would type man rm.
Finally, lets try to create a simple text file. There are many command line editors in Linux (Gedit, Nano, Pico, Joe, Emacs, etc) but one is almost certainly present on any distribution by default, so without need for additional installation. It’s Vim editor. Unfortunately, it’s quite complicated for beginners to master. However, because of its omnipresence it’s really worth to learn few basics to be able to quickly edit configuration file or to create simple text file. To start editor type command vi with name of the file you would like to create or edit, for example vi some-file. When the editor opens file type letter i which is short for insert and now you can add or change whatever you need in your file. When you are finished with editing type ESC and then :wq, which means write and quit. And that’s it. Of course, many things can go wrong if you type wrong button but that’s why Vim has reputation of hard to learn ;).
It’s hard to say precisely, how many hours one would need to learn Linux commands to the point of easy navigation through Linux file system. Probably between 50-100 hours.
In some future tutorials on Linux commands I’ll show you how to install and use other editors and we will continue with some other very important commands and config files.