Learn Linux Basics

Linux is an open-source Operating System (OS) based on the Unix kernel. It was first developed by Linus Torvalds in 1991. Unix-like Linux shares many similarities with the original Unix OS. It is free to use and has a vast community of developers and contributors who continue to improve and expand its capabilities. From this writing, you will learn about the fundamental basics of each section that covers various aspects of Linux.

Introduction to Linux

Linux is a free & open-source OS, meaning anyone can freely use, modify, and distributor its source code licenses like GNU GPL (General Public License). As the GNU Project provides many components used in these distributions, some controversies exist over its naming convention, with the Free Software Foundation advocating for the term ‘GNU/Linux’.

Linux is often packaged as a complete system with supporting libraries, known as a Linux distribution. Some famous Linux distros are Ubuntu, Fedora, and Debian, which have various modifications like XUbuntu and Lubuntu. Linux supports multiple desktop environments like KDE Plasma, XFCE, GNOME, etc.

Originally designed for Intel x86 architecture-based PCs, Linux now works on various systems, including Android smartphones, leading to its broad installed base.

Where is Linux Used?

Linux is used in a wide range of applications and environments. It’s used in personal computers, server markets, supercomputers, and many more. Not only that, its versatility extends beyond traditional computers and it’s used in embedded systems too. For example, spacecraft, automobiles (Toyota, Tesla, Audi, etc.), smart TVs,  mobile devices, and routers.

Linux Terms

Kernel, Shell, & Terminal

Before diving into the technical aspects, let’s familiarise ourselves with some essential Linux terms:

  • Kernel: The core component of the Linux operating system that interacts with hardware and manages system resources. It helps the communication between hardware & software.
  • Shell: A command-line interface that allows users to interact with the operating system by executing commands. While the Kernel is the innermost part of an OS, a shell is the outermost one.
  • Terminal: A text-based interface used to enter commands and receive output. When you run the terminal, the Shell issues a command prompt (usually $), where you can type your input, which is then executed by the ENTER, and the output is thereafter displayed on the terminal.
  • Desktop Environment: A graphical user interface that provides a cohesive and user-friendly experience on Linux such as GNOME, KDE, or XFCE.
  • Distribution: A specific version of Linux that includes the Linux Kernel, utilities, and software packages.
  • Repository: A collection of software packages maintained by the distribution, which can be accessed and installed using the package manager.

Linux Distributions

A Linux distribution or distro is a complete OS built around the Linux kernel. It comes with various pre-installed software packages such as graphical desktop environments, command line utilities, programming tools, and other applications. Some popular Linux distributions are:

  • Ubuntu: A user-friendly distro suitable for beginners and general-purpose computing.
  • Fedora: Fedora is supported by the Fedora project, an endeavor by Red Hat.
  • Debian: It is a stable and popular non-commercial Linux distro.
  • CentOS: It is one of the most used Linux distributions for enterprise and web servers.
  • Arch: Popular Linux distro amongst developers.

Linux Installation

To install the Linux Operating System, first, choose a Linux distro that will be compatible with your system’s hardware specification & will meet your preferences. After you have decided you can install a Linux OS for your system in several ways. Such as:

  • Bootable USB/DVD Installation: The most common way is to create a bootable USB flash driver or DVD containing a Linux distribution, and then boot your computer from it to initiate the installation process.
  • Network Installation: Some Linux distros offer network-based installations, where the installer fetches the required files from a remote server instead of using physical media.
  • Virtual Machine Installation: You can install it on a virtual machine (Virtual Box, VMware) running on your current OS, without affecting your main system.
  • Dual-Boot: If you want to keep your existing OS and have both Linux and another OS on the same computer, you can set up a dual-boot configuration.
  • Wubi (Windows-based Ubuntu Installer): For Ubuntu users on Windows, Wubi allows you to install Ubuntu like any other application, creating a double-boot environment without modifying partitions.
  • Disk Imaging: You can create an image of an already installed Linux system and restore it to other machines, effectively replicating the same installation.

System Requirements

The system requirements for Linux can vary depending on the specific Linux distribution and the intended use of the OS. However, in general, Linux is known for being lightweight and capable of running on a wide range of hardware configurations. Some general system requirements for running Linux are:

Processor (CPU)

  • For modern Linux distros, a 1 GHz or faster processor is recommended.
  • Older or lightweight distros may run well on slower processors, such as 500 MHz.

RAM (Memory)

  • A minimum of 1GB of RAM is typically recommended.
  • For a smoother experience and better multitasking, 4GB or more of RAM is preferred.

Storage (Hard Disk)

  • Most Linux distros can run comfortably on 10GB o 20GB of storage space.
  • For a more extensive software installation or data storage, a larger hard disk is needed.

Display Resolution

  • Linux can support various display resolutions, from Standard Definition (SD) to High Definition (HD) and 4k.

Upgrade & Update

Updating Linux typically involves installing the latest security patches, bug fixes, and updates for the installed software packages. The package manager (e.g. APT for Debian/Ubuntu) is used to fetch the latest updates from the distro’s repositories and apply them to your system. You can update packages in Ubuntu using APT by the following command:

sudo apt update

On the other hand, Upgrading refers to moving from one version of the Linux distro to a newer version. And this involves a major change in system components. Upgrades provide new features, improvements, and better compatibility with the latest hardware and software. You can upgrade the Ubuntu distro by the following command:

sudo do-release-upgrade

Linux Commands

In Linux, a command is a text-based instruction provided by the user to the operating system. These commands are entered into the terminal or shell, which is a command-line interface used to interface with the OS. When a command is executed, the shell interprets it and carries out the specified system. Now there are subtle differences between terminal, shell, and command-line-interface:

  • A terminal is a text-based window running a shell, providing an input and output environment.
  • A shell is a program that allows interaction with the computer’s OS, and in Linux systems, it serves as a command line interpreter within a terminal.
  • A CLI, managed by a command line interpreter program, processes user commands and produces output.

Linux commands are essential for interacting with the system. Some of the most used commands are:

  • ls → List files and directories in the current location.
  • pwd → Displays current working directory.
  • cd → Change directory.
  • rm → Remove files or directories.
  • mkdir → Create a new directory.
  • touch → Create, change, & modify timestamps of a file.
  • cat → Display file content.
  • grep → Search for a pattern in files.

Linux Help

Getting help in Linux is easy. You can use various commands to access helpful information about other commands and programs. Some of these command-line tools are:

  • help: Displays help information about shell built-in commands. It provides a list of available commands & a brief description of their functionality.
  • whatis: Provides a one-line description of a command’s purpose.
  • man: Short for ‘manual’, the man command is used to display the manual pages for various commands. It provides detailed documentation, usage, and examples.
  • info: Similar to man command, info provides documentation for commands and programs but in a different format.
  • apropos: Searches the manual page names and descriptions for a specified keyword and returns a list of relevant commands and their descriptions.

Linux File System

Virtually all Linux distributions adhere to a widely recognized standard for filesystem organization called the Filesystem Hierarchy Standard (FHS).  And, FHS prescribes a series of directories, each serving a distinct and specialized role.

The hierarchical structure starts from the root directory ‘/’, and all files and directories are organized under it. When a user logs into the shell, they are directed to their individual user directory, found within the home directory (symbolized by ‘~’ ). For example, if a user with the username ‘john’ logs in, they will be taken to the directory /home/john/ as their home directory. Check out the following graphical representation of the filesystem: File hierarchy in Linux basics For administrative purposes, there is a special user account known as the ‘root’ user, which has superuser privileges and can perform system-level tasks. The root user also has a designated home directory, represented by /root/. And this directory is separate from the root directory of the entire filesystem, which is simply denoted by the forward-slash (/).

To clarify the difference between the two:

  • The root directory (represented by /) is the top-level directory in the Linux filesystem, and it contains all other directories and files.
  • The root user’s home directory (represented by /root/) is a specific folder reserved for the root user, allowing them to store their own files and configurations separate from regular users’ home directories.

Here are some important directories:

  • /home: User home directories.
  • /etc: Configuration files.
  • /var: Variable data, such as log files and databases.
  • /dev: Device files.
  • /tmp: Temporary files
  • /proc: Virtual filesystem containing information about running processes.

Linux Text Editors

In Linux, there are several text editors available, each with its own features. Below are some popular Linux text editors that developers commonly use for programming and general text editing tasks:

  1. Nano: The nano is a user-friendly text editor that offers many other extra features like word searching, replacing, jumping to a line or column, filename tab completion, auto-indentation, etc.
  2. Vim: Vim is an open-source, fast, and powerful text editor for the Linux operating system.
  3. GNU Emacs: GNU Emacs is a text editor that features efficient commands for common but complex actions and for plugins and configuration hacks.

But, from all of them, Nano text editor is one of the most efficient text editors mainly for bash scripting.

Linux Permissions

In Linux and Unix-like operating systems, file permissions are used to control access to files and directories that ensure privacy & security. These permissions determine who can read, write, or execute files and directories. Permissions are represented by three sets of characters: owner, group, and others. And the three basic permissions are read (r), write (w), and execute (x).

Permission Indicators

The permissions are represented by a 10-character string, with the first character representing the file type (– for normal files & d for directory). There are several ways to view file permissions in Linux, but the frequently used way is to use the ls command with the –long option, just type the command ls -l in the directory in which the file resides. You will get output, like the following image: Viewing file permission The first 10 file attributes (-rwxrw-r– ) of the output indicate file type & permissions to read-write-execute the file for the owner, group & others. Check the below illustration for a clear understanding. Permission indicators in Linux permisssion basics

Changing Permissions

Now that you know how file permissions work in Linux, next let’s see how to modify these permissions. The command that is used to change access permissions of any file or folder permission is the chmod command (change mode). It works in both Symbolic (Uses symbols) & Absolute (Uses numbers/octal) modes.

For example, to give the owner execute permission and others write & execute permissions  for a file you can use the following syntax of the chmod command:

chmod u+x,o+wx  file.txt
EXPLANATION
  • chmod: Changes access permission of files & directories.
  • u+x,o+wx: Adding (+), execute (x) permission for the user (u) & write-execute (wx) permissions for others (o).
  • file.txt: File name.

Files in Linux

In Linux, files are the fundamental data storage units containing information, data, or programs. Everything in Linux is treated as a file (even a directory) & if it’s not a file, then it is a process.

File Naming Conventions

To prevent running into problems with your file paths while working on your system, remember:

  • Filenames are case-sensitive. For example, ‘File.txt’ and ‘file.txt’ are considered two distinct files.
  • Special characters like /, *, ?, :, $, %, are not typically allowed in filenames.

File Types

There are different types of files in Linux. Some common types include:

  • Regular files (-) → Contains standard data files, such as text files, documents, images, or executables.
  • Directories (d) → Files that contain other files & directories, forming a hierarchical structure.
  • Symbolic links (l) → Files that point to another file or directory, acting as shortcuts or aliases.
  • Special files (i.e., device files) → Represents hardware devices, such as hard drives or printers.

Linux File Operation Commands

Users can perform various operations on files by using the following command-line tools available in Linux:

  • file → Determines file type
  • touch → Used to create a file.
  • mkdir → Used to create a directory.
  • rm → To remove a file.
  • rmdir → To remove empty directories.
  • cp → To copy a file.
  • mv → To rename or to move a file.
  • rename → To rename a file.

Linux Redirection

Redirection is a process that allows you to change the default input source or output destination of a command. Check out the following cases of redirection available in Linux:

Redirecting Input

Redirecting input is a process where the standard input (stdin) of a command is changed from the keyboard to a  file. By, using the ‘<’ symbol you can take input data from a file instead of typing it interactively. For example,

cat < file.txt

Redirecting Output

Here, the displaying of the standard output (stdout) of a command is changed from the terminal screen to a file or to another command’s input. The ‘>’ symbol is used for this purpose. For example,

ls > output.txt

Appending Redirected Output

Normally, when you redirect a stdout to a file with the ‘>’ redirection operator, it overwrites the file. You can also append the stdout to the existing file contents while redirecting by using the ‘>>’ redirection operators. For example,

ls >> output.txt

Redirecting Standard Output and Standard Error

In Linux, every process has two default output streams, stdout (represented by file descriptor 1) & standard error or stderr (represented by file descriptor 2). You can redirect both of them using the symbol ‘&> or ‘>&’ or ‘2>&1’. For example,

ls /nonexistent_directory &> log.txt

Appending Standard Output and Standard Error

In the same way as appending stdout, you can append both stdout & stderr simultaneously to the same file too. For that, use the append symbol ‘>>’. For example,

ls >> output.txt 2>&1

Linux Piping

In Linux and other Unix-like operating systems, a pipe is a means of redirecting standard output from one command to another for processing. By using the pipe character ‘|’, you can connect one command’s output to another command’s input. It enables commands to operate simultaneously and transfer data continuously, without using temporary files or the display screen.

Pipes are unidirectional, flowing data from left to right through the pipeline.

Command Syntax >

Command 1 | command 2 | … | Command N

Linux Package Management

Package management in Linux is the process of installing, updating, and removing software packages from specific repositories (repos). It enables easy installation and updates of software package managers. There are various package managers used in different Linux distros. For example:

  • Debian/Ubuntu: ‘APT’ package manager
  • Fedora: ‘DNF’ package manager
  • Red Hat: ‘RPM’ package manager

Now if I talk about the ‘APT’ package manager in a little more detail, it is used by Debian-based distributions such as Ubuntu, Linux Mint, and Debian itself. It uses ‘apt’ or ‘apt-get’ command-line tools to manage packages. The central package repository is often accessed via sources listed in the ‘/etc/apt/sources.list’ file. Use command syntaxes,

  • To install a package →
sudo apt-get install package_name
  • To update the package list →
sudo apt-get update 
  • To upgrade installed packages →
sudo apt-get upgrade
  • To remove a package →
sudo apt-get remove package_name 

Linux Process Management

Linux process management refers to the management and control of running processes on a Linux-based OS. Now, a process is an instance of a program that is currently being executed by the system. The Linux kernel provides several tools and commands to manage processes effectively. Some key aspects of process management are:

Process States

There are different states of these processes, such as:

  • Running: The process is currently executing on the CPU.
  • Sleeping: The process is waiting for a specific event, such as I/O completion or a signal.
  • Stopped: The process has been paused or stopped, often in response to a user or system request.
  • Zombie: A process that has completed its execution but is still in the process table until its parent process agrees to its termination.

Process Management Commands

Linux provides many command-line tools to manage all these processes. Some of these commands are:

  • ps: Displays info about currently running processes.
  • top or htop: Provides monitoring of processes, system resources, and CPU usage.
  • kill: Sends a signal to terminate a process gracefully or forcibly.
  • killall: Terminates all processes with a given name.
  • pgrep and pkill: Allow you to find and signal processes based on their attributes & names.
  • nice and renice: Adjust the priority of a process to control its CPU usage.
  • bg and fg: Control background execution of processes.

Process Monitoring & Control

Some key aspects of process monitoring & control are:

  • Signals: Processes communicate with each other using signals, which are used to instruct a process to perform certain actions. (i.e., terminate, pause, or reload).
  • Job Control: The ability to manage multiple processes and their execution in the foreground or background using the shell.
  • Process Priorities: Each process has a priority assigned to it, which determines how much CPU time it receives relative to other processes.

Process Hierarchy

While understanding the Linux process hierarchy, remember:

  • Each process in Linux has a parent process, except for the initial process (PID 1).
  • When a process is terminated, its child processes become orphaned and are automatically adopted by the init process (PID 1).

Linux System Monitoring

System monitoring involves tracking the performance and resource utilization of a system. Efficient monitoring helps ensure optimal system performance, identify potential issues, and troubleshoot problems.

How System Monitoring Helps

System monitoring helps you to,

  • Identify resource bottlenecks.
  • Detect and resolve performance issues.
  • Monitor hardware health.
  • Plan for system upgrades.

Monitoring Tools

Linux provides various tools to monitor system performances, such as:

  • top or htop → Provides monitoring of processes, system resources, and CPU usage.
  • vmstat → Reports statistics about processes, memory, block I/O, and CPU usage.
  • lsof → List of all the open files and processes.
  • iotop → Monitors I/O usage and helps identify processes causing high I/O load.
  • nload → Displays network usage.
  • sar → Collects, reports, and saves system activity information.

Conclusion

To sum up, when you start Linux as your OS, you ought to learn the basics related to the OS to function properly & effectively. In this writing, I tried to give a summarized idea of the sections you need to cover to know about Linux at the beginning. Hope this article helps!

People Also Ask

How to learn basics of Linux?
To learn Linux basics, first, pick a beginner-friendly distribution like Ubuntu, Linux Mint, or Fedora. After installing, learn essential Linux terms, explore file operations, practice commands, learn to use text editors, and watch online tutorials & read Linux-related content to dive deeper

Is Linux easy to learn for beginners?
Linux isn’t hard to learn if you have some basic tech knowledge and an understanding of operating systems. It really depends upon the user’s experience, expertise, and approach.

Can I learn Linux by myself?
Absolutely, you can learn Linux by yourself. When you will have self-study resources, like online tutorials, video tutorials, manuals, and books, you can easily learn & practice Linux all by yourself. Moreover, join different Linux communities where you can ask questions & seek advice.

Where to learn Linux beginners?
As a beginner, there are several excellent resources available online to learn Linux. For example, online tutorials and websites, video platforms, manuals & documentation, books & ebooks, community forums, online courses, etc.

Related Articles

4.8/5 - (23 votes)
LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now
icon linux
Monira Akter Munny

Hello!! This is Monira Akter Munny. I'm a Linux content developer executive here, at SOFTEKO company. I have completed my B.Sc. in Engineering from Rajshahi University of Engineering & Technology in the Electrical & Electronics department. I'm more of an online gaming person who also loves to read blogs & write. As an open-minded person ready to learn & adapt to new territory, I'm always excited to explore the Linux world & share it with you! Read Full Bio

Leave a Comment