Linux

What is Linux?

When we talk about Linux, we are really talking about the Linux kernel. The kernel is the core of an operating system, the part that interfaces directly with the hardware components. Linux is more of a class of operating systems than one single operating system. The common aspect that all of these operating systems share is they all use the Linux kernel. We call all the operating systems that use the Linux kernel, 'distributions'.

Linux Distributions

Linux distributions come in all shapes and sizes. Linux is ultimately an incredibly powerful and customisable operating system, and we can see this reflected in the variety of distributions available.

Desktop Distributions

Linux desktop distributions come with a GUI (Graphical User Interface). Historically the GUI on Linux has been terrible; more of a bolted on afterthought than a real usable product. More recently, that has been changing, and there has been a real push to make Linux accessible to more people.

Server Distributions

Just as with Windows, Linux distributions that are specialised for use on servers exist also. These don't come with any GUI installed at all; everything must be done using text-based commands in the 'terminal'. In fact, Linux was originally command line only and didn't have a GUI at all. To this day, the most powerful way to get something done on Linux is to use the terminal, even on desktop distributions.

Linux Terminal

We already covered the Linux terminal briefly. Originally, Linux did not have a GUI, and everything was done from the command line. Eventually, a GUI was written and incorporated into many desktop distributions, but ultimately the GUI is still just a thin facade over the command line. This structure is the opposite to Windows where the GUI is the core of the operating system, and some things can't be done from the Windows command prompt at all. Ultimately, this means that on Linux the terminal is incredibly powerful.

Shell

When you open the terminal, it runs a program automatically. The program that it runs is called the 'shell'. The shell is responsible for displaying the prompt, interpreting the commands you type, running programs and displaying the output to you. There are many different shell programs, but by far the most common currently is the 'bash' shell.

Bash stands for Bourne Again Shell; it's a clever play on words. One of the earlier shell programs was the Bourne shell, and Bash was written as a modern shell program to replace it. The default path for bash is /bin/bash. The first '/' means the root of the file system, from the root of the file system, in the 'bin' folder is the 'bash' program.

You can select a different shell and customize this heavily, introducing powerful new functionality but this setup is the most common starting point you will find.

Superuser

The superuser account on a Linux system is effectively the administrative account. It's the account with total control over the operating system and has permissions to do anything and everything. There is always at least one superuser account on every Linux system, and the account name is usually called 'root'. I've yet to see a Linux system where the superuser account was called anything other than 'root', although given how customisable Linux is, it's possible there could be one distribution of Linux that doesn't follow convention.

On a Windows system, the administrative account isn't actually capable of doing anything it wants on the system. There are some things the administrator isn't qualified to do, typically things that would break the operating system irrevocably. On Linux, the root account can do absolutely anything it likes, even up to and including breaking the operating system.

On Windows, anything you do is usually followed by, "Are you sure you want to do this?". After you answer yes, you get another prompt "Are you really really sure you want to do this?". Alright, that's something of an exaggeration, but the point remains. Linux likes to keep things interesting though; it doesn't like to prompt you about anything, particularly if you are root. Typically, you'll type in a command, and the operating system will just do it. Delete the whole file system? Sure, all gone. You're root, so you're allowed to do that.

Using the root account for daily activities is a bad practice. You should always log in to a system as a normal user account. From there, you can switch user to root if you need to. 

Linux commands are a set of instructions that can be executed in a Linux operating system. They allow users to interact with the system, perform various tasks, and manage files and processes. Some commonly used Linux commands include:

  • ls: Lists files and directories in the current directory.

  • cd: Changes the current directory.

  • mkdir: Creates a new directory.

  • rm: Removes files and directories.

  • cp: Copies files and directories.

  • mv: Moves or renames files and directories.

  • grep: Searches for a specific pattern in files.

  • chmod: Changes the permissions of files and directories.

  • ps: Lists running processes.

  • top: Displays real-time system information

  • cat: stands for 'concatenate'. It's used for joining the contents of several files together and then printing the result to the terminal.

  • less: The 'less' command is used for reading long files.

  • find: used to find files on a system

  • which: command can show you where in your PATH a tool is installed.

  • apropos: used to pull up a manual page on tools installed on your Linux system

  • nano: command-line based text editor.

  • vim: another text editor, similar to 'nano' except it is a lot more powerful.

  • file: command can tell us the filetype of a file.

  • strings: command is used for pulling text sequences out of binary files.

  • wget: It allows us to download files from the internet