Linux Crash Course for Beginners

Aug 26, 2021

🙋‍♂️ Need Help? Ask Here 📺 Video Tutorial

Linux Crash Course for Beginners

This is the perfect place to start if you are new to the Linux operating system. We will be focusing on using a remote Linux server, so you can follow this tutorial no matter what operating system you have.

The corresponding YouTube video for this blog post can be found here.

Table of Contents

Getting your VPS setup

To follow along with this tutorial you will need a VPS (virtual private server). This is basically just a remote Linux server that you can rent for a small monthly fee.

If you are interested in learning for free then check out this video where we explain how you can get $100 in free VPS credit for up to 30 days. The rest of the article will assume you have a VPS you can login to with root access.

The ability to move around your VPS and it’s folder system is critical. Thankfully there are a few commands that make this very easy to do.

pwd - Print Working Directory
This command will display what directory you are currently in. I was in the /root directory when I ran this command:

mkdir - Make Directory
This command will create a new directory/folder:

ls - List
This command will list all of the files in your current directory:

“snap” is a default directory in the root folder, and “test” is the directory we just created with the previous “mkdir” command. Directories will show up with a blue color, while files will be white.

You can even list the contents of another directory like so:

Running “ls test” lists any files within the “test” directory, however we just created it so there are no files in that directory yet.

cd - **Change Directory
**Let’s navigate to our new “test” directory:

We now see “[email protected]:~/test” before any of our commands. Anything after the colon is the current path we are at. We can also run pwd to check the current directory.

To go back one directory you can use cd .. like so:

Useful Console Tips

“clear” Command

You can run the clear command OR use CTRL + L (CMD + L on Mac) to clear your console. This removes any clutter from previous commands.


After CTRL + L:

“history” Command
You can run the history command to view the commands you have previously ran:

up arrow
You can use your up directional key to go through previously used commands. This makes it very continent to easily access and run commands again.

Creating and Editing Files

You will be commonly working with files in some way when using Linux.

nano - Easy to use text editor
Nano is the easiest text editor to use in Linux. It can either edit an existing file, or create a file to edit. Here I am creating a file named “notes”:

Afterwards your terminal will look like this:

If you start typing anything it will appear in the text editor. The controls for this editor are listed at the bottom. A carrot (the ^ symbol) represents CTRL on Windows and CMD on Mac. You can use these with the given character to perform a certain action. For example CTRL/CMD + X will close the file.

Try to write out something in your text editor then use CTRL/CMD + X to close your file. It will ask if you want to save your modified buffer like so:

Simply press the “Y” key. It will then ask for the file name you would like to use. By default this will be filled with the current file name that you are editing, however you can change the file name here if you would like. For now simply click enter to select the default file name:

You should be sent back to the main terminal. You can use ls to confirm that your file was created:

touch - Creating a file
Sometimes you may want to create a file without editing it’s contents. You can achieve this with the touch command like so:

cp - Copy
You can copy files with the cp command:

You can also copy files into a directory like so:

To copy directories you must provide the -r flag:

mv - Move or rename file
You can use the move command to either rename or move a file/directory. Let’s say I wanted to rename my “notes” file to “tutorial”:

You can also use mv to move files into different directories. I’m going to move the “tutorial” file into “test”:

cat - Concatenate
Often used to print the contents of a file into the terminal:

rm - Remove
The rm command can be used to delete a file like so:

rm -R - Remove a directory and it’s contents
You can delete a directory with rm -R:

Package Managers

Package managers allow you to install and manage 3rd party software on your VPS. Before starting it is important to ensure everything is up to date with apt update. This might take a few minutes depending on when you setup your VPS.

Installing Packages

Next let’s look at how to install a package like "fail2ban" which helps with security:

The -y flag will automatically accept any yes/no prompts you will get, this is optional.

Enabling Packages to run at Startup

If you want some programs to auto run when your machine starts up you can use the systemctl command like so:

Checking Software Status

You can check if some software is running correctly with the systemctl command like so:

Updating Specific Packages

You can easily update specific packages:

Removing Packages

You can also easily remove packages:

How to Secure your VPS

I have a complete YouTube video going over VPS security fundamentals. You can check it out here.