Essential Linux Knowledge for Beginners

Linux is an open-source operating system developed by Linus Torvalds in 1991. At its core, Linux consists of the Kernel.

What is the Linux Kernel?

The Linux Kernel is:

  • Free and open-source software.

  • A Unix-like operating system kernel.

  • It directly interacts with the hardware, managing the system’s resources and processes.

Most importantly, Linux is not Unix.

Linus Torvalds created the Linux kernel and combined it with GNU software, a project that aimed to develop a free operating system. After its creation, the Linux kernel quickly became the kernel for the GNU operating system, forming a free replacement for Unix. This combination led to the creation of numerous distributions commonly referred to as Linux.

Linux distributions combine the Linux kernel with other software, such as GNU tools and various pre-installed applications.


Working with Directories

man

The man command stands for manual. It is used to provide information about every command available in the Linux terminal. Essentially, it pulls up the smart database that hosts all the manuals for different commands.

Example:

man ls

pwd

The pwd command stands for "present working directory" and prints the name of the current directory.

Example:

pwd

ls

The ls command lists directory contents.

Examples:

ls        # Lists all files and directories
ls -l     # Lists contents in long format, showing detailed information
ls -a     # Lists all files, including hidden ones

cat

The cat command is used to concatenate files and display their content in various ways.

Examples:

cat file.txt             # Displays the content of file.txt
cat file1.txt file2.txt  # Concatenates and displays content of file1.txt and file2.txt
cat > newfile.txt        # Writes new content into newfile.txt

Linux File Structure

In Linux, everything is a file. The OS stores and manages data on disks or partitions using a structure called the File System, which includes files, directories, and permissions.

Important Directories

  • /: Represents the root of the file system. Every file in the OS is stored under this location, similar to the C drive in Windows.

  • /bin: An important directory where most binary files are stored. Commands like pwd and man have their binaries here.

  • /boot: Contains boot files and GRUB, which is a program that allows us to select and boot the OS. It’s crucial, so avoid making changes here.

  • /cdrom: Used for mounting disk drives. When you insert a disk, it appears here.

  • /dev: The place where physical device files are located, such as hard drives, USBs, and optical drives.

  • /etc: Stores configuration files for installed applications, such as Apache, MySQL, and SSH.

  • /home: Contains user directories. When a new user is created, a home directory is created for that user to store personal files like documents and photos.

  • /lib: Stands for "System Libraries." Required libraries for running applications are stored here. Additional libraries downloaded during package installations also end up here.

  • /sbin: Contains binaries for system administration, used by the root or superuser.

  • /proc: Stands for Process Information. It contains details about system processes and kernel states.

  • /sys: Contains information related to hardware and the kernel.

  • /usr: Stands for User Programs. It contains read-only data, including libraries, binaries, documentation, and source code, often shared among users.

  • /var: Holds files that change frequently, such as log files, temporary email files, and caches.

  • /opt: Stands for optional application add-on packages. Third-party tools like FortiClient or Google Chrome store their details here.

  • /snap: Stores temporary files, which are usually deleted upon system shutdown.

Conclusion:-

Linux is a powerful and versatile operating system that has become a cornerstone of modern computing. Its open-source nature allows for extensive customization and community-driven development, making it a popular choice for a wide range of applications, from personal computing to enterprise servers. Understanding the basics of Linux, including its kernel, file structure, and essential commands, provides a solid foundation for anyone looking to explore or deepen their knowledge of this robust operating system. Whether you're a beginner or an experienced user, mastering these fundamentals will enhance your ability to navigate and utilize Linux effectively.