Fundamentals of Linux

Fundamentals of Linux

#90DaysofDevOps

Day 2 of 90

Linux Fundamentals

Linux is an open-source operating system that is widely used in a variety of applications, from personal computing to large scale server administration. It is known for its stability, security and versatility; making it a popular choice for many users. Below I have written about some basics of Linux every IT personnel should know.

Understanding Linux Distributions

Linux is available in many different versions, known as distributions or "distros." or simple words; Linux flavours. These distros vary in their user interface, package management system, and default applications. Some popular Linux distros include Ubuntu, Fedora, Debian, and CentOS.

Understanding the Linux File System

The Linux file system is structured differently than that of Windows or Mac OS. The root directory, represented by "/", is the top level of the file system. Everything in Linux is treated as a file, including directories, devices and even processes. Directories are used to organize files, and they are indicated by a forward slash ("/") in the file path.

Command-Line Interface (CLI)

Unlike Windows or Mac OS, Linux has a powerful command-line interface (CLI) that allows you to interact with the system using text commands. The CLI is often used for system administration tasks and is essential for any user who wants to become proficient in Linux.

Here are some basic CLI commands to get you started in Linux:

  • cd: Change directory

  • ls: List the contents of a directory

  • mkdir: Create a new directory

  • rm: Remove a file or directory

  • cp: Copy a file or directory

  • mv: Move or rename a file or directory

  • cat: Display the contents of a file

  • nano: A simple text editor for the CLI

  • top: Display real-time system performance metrics.

    Managing user accounts and permissions

Another important aspect of Linux is user management. In Linux, user accounts are used to control access to system resources, such as files and directories.

Here are some basic CLI commands to manage user accounts:

  • useradd: Add a new user account

  • userdel: Delete an existing user account

  • passwd: Change a user's password

  • su: Switch to another user account

  • sudo: Execute a command with root privileges

User accounts are associated with permissions that determine what actions they can perform on the system.

There are three main types of permissions in Linux:

  • Read: Allows a user to view the contents of a file or directory

  • Write: Allows a user to modify or delete a file or directory

  • Execute: Allows a user to run a program or script

Permissions are set using a series of three numbers, each representing the permissions for a specific user group.

The numbers are calculated as follows:

  • 4: Read permission

  • 2: Write permission

  • 1: Execute permission

    Installing and Managing Software Packages

Linux offers a wide range of software packages that can be installed and managed using package management tools. Linux uses package management systems to install, update and remove software. Package managers help users avoid the hassle of manually downloading and installing software and they ensure that the system stays up to date and secure. Popular package management systems include apt, yum, and pacman.

Here are some basic CLI commands to manage software packages:

  • aptget: Install or remove packages using the Advanced Packaging Tool (APT) on Debian-based systems

  • yum: Install or remove packages using the Yellowdog Updater, Modified (YUM) on Red Hat-based systems

  • dpkg: Install or remove packages using the Debian package management system

  • rpm: Install or remove packages using the Red Hat package management system

Package management tools allow you to easily install, remove and update software packages, ensuring that your system is always up to date and secure

Networking and Security

Networking is another important aspect of Linux. Linux offers a wide range of networking tools and utilities that can be used to manage network connections, configure firewalls, and perform network troubleshooting.

Here are some basic CLI commands to manage networking in Linux:

  • ifconfig: Displays network interface configuration information

  • ping: Sends a test packet to a network host to check connectivity

  • traceroute: Displays the route that network packets take from one host to another

  • netstat: Displays information about network connections, routing tables, and network interfaces

  • iptables: Configures and manages the Linux firewall

Security is also a major concern in Linux, especially if you're using it for server administration. Linux offers a wide range of security tools and utilities that can be used to protect your system from malicious attacks.

Here are some basic security CLI commands to get you started:

  • passwd: Change your password

  • croot: Change the root directory for a process to a new location

  • sudo: Execute a command with root privileges

  • ssh: Securely connect to a remote server over the network

  • gpg: Manage cryptographic keys and encrypt files

Summary
In conclusion, Linux is a powerful and versatile operating system that can be used for everything from personal computing to large-scale server administration. With some basic knowledge and practice, you can quickly become proficient in using Linux and take advantage of all it has to offer.