A Quick Linux Overview -2

A Quick Linux Overview -2

·

12 min read

Welcome to yet another article on Linux, if you are here for the first time, welcome, my new convent 🌚 Do well to read the first part of this article. As for my devoted readers who keep reading my articles, thank you for your constant feedback and support. You are much appreciated and valued. This is part two of this quick trip down the Linux Lane and I will be talking about the different industries Linux can be used, the most popular Linux distributions, Linux file system hierarchy, Linux Basic Commands, Examples of using the cat command for file and directory operations and Linux permissions and ownership management. So let’s get to the details.

DIFFERENT INDUSTRIES LINUX CAN BE USED.

Because of its flexibility, reliability, and open-source nature, Linux is a flexible operating system that is utilized across a wide range of industries. Here are some instances of how Linux is being used in various industries:

  1. Web Hosting and Data Centers: For web hosting and data center operations, Linux is a popular choice. Its dependability and ability to handle server resources efficiently make it excellent for hosting websites, applications, and databases. Many large-scale websites and cloud providers run their infrastructure on Linux-based computers.

  2. Finance and Banking: Linux is widely utilized in the finance industry because of its security and dependability. Linux is frequently used to perform high-volume and time-sensitive jobs in trading platforms, risk management systems, and transaction processing systems.

  3. Embedded Systems and IoT: Linux is a popular operating system for embedded systems and Internet of Things (IoT) devices. Its scalability and ability to run on many hardware architectures make it excellent for smart devices, routers, set-top boxes, and industrial automation.

  4. Scientific Research and Supercomputing: Because of its ability to leverage the power of high-performance computer clusters, Linux is a popular choice for scientific research and supercomputing. Many of the world’s fastest supercomputers run Linux, which helps academics to handle complex simulations and data analysis more effectively.

  5. Academic and Educational Institutions: Because of its open-source nature and the opportunity for students to learn about operating systems and programming, Linux is frequently utilized in educational settings. It offers a low-cost way for schools and institutions to set up computer labs and teaching settings.

  6. Aerospace and Defense: In the aerospace and defense industries, Linux is utilized in mission-critical systems, flight control software, and communication systems. In many applications, its stability and capacity to perform real-time activities are advantageous.

  7. Government and Public Sector: Because of its open-source nature, cost-effectiveness, and security features, Linux is used by many government agencies and public-sector enterprises. It’s used in things like server infrastructure, data management, and public-sector applications.

These examples demonstrate how Linux’s features serve a wide range of businesses. Because of its adaptability, customization choices, and community-driven development strategy, it is a great asset in a variety of disciplines.

MOST POPULAR LINUX DISTRIBUTIONS.

There are numerous Linux distributions available, each catering to different needs and preferences. Here are some of the most popular and well-known Linux distributions:

1. Ubuntu: An extremely popular and user-friendly distribution, suitable for both beginners and experienced users. It comes in various flavors, including the standard Ubuntu Desktop, Ubuntu Server, and flavors like Ubuntu GNOME, Ubuntu KDE, etc.

  1. Linux Mint: Based on Ubuntu, Linux Mint focuses on providing a more polished and user-friendly experience. It offers a choice of desktop environments and aims to be easy to use for newcomers.

3. Debian: Known for its stability and strict adherence to open-source principles, Debian serves as the foundation for many other distributions. It’s available in various flavors and is popular for server use.

4. Fedora: Backed by Red Hat, Fedora is known for its cutting-edge software and commitment to open-source ideals. It serves as a testing ground for technologies that might eventually make their way into Red Hat Enterprise Linux.

5. CentOS: Derived from the sources of Red Hat Enterprise Linux (RHEL), CentOS provides a free and open-source alternative to RHEL. It’s often used for server environments.

6. Kali Linux: Designed for cybersecurity professionals and enthusiasts, Kali Linux comes preloaded with a variety of security tools for penetration testing and digital forensics.

7. Elementary OS: Focused on providing a sleek and user-friendly interface, Elementary OS is often compared to macOS in terms of design and aesthetics.

8. openSUSE: Known for its flexibility and variety of desktop environments, openSUSE offers both openSUSE Leap (more stable) and openSUSE Tumbleweed (rolling release) options.

Remember that the “best” distribution depends on your specific needs, preferences, and level of experience. Each distribution has its strengths and weaknesses, so it’s a good idea to explore a few options before settling on one that suits you best.

LINUX FILE-SYSTEM HIERARCHY

The Linux File System Hierarchy is a hierarchical arrangement of directories and files in Linux and other Unix-like operating systems. It specifies the locations of various types of files as well as the function of each directory. This hierarchy allows for the consistent and ordered management of system files, user data, configuration files, and other files. The following is a list of the principal folders and their functions in the Linux File System Hierarchy:

  1. / (Root Directory):

The top-level directory, denoted as “/”, is the starting point of the file system hierarchy. Everything in the system is contained within subdirectories of the root directory.

2. /bin (Binary Binaries):

Essential command binaries that are required for system booting and repair. These binaries are available for all users and are necessary for basic system functionality.

3. /sbin (Superuser Binaries):

Similar to /bin, but contains binaries that are primarily used by the system administrator (root) for system maintenance and administration tasks.

4. /usr (User System Resources):

Contains user-related programs, libraries, documentation, and more. This directory is often read-only and can be shared across multiple machines using network file systems.

  1. /lib (Libraries):

Libraries are required by binaries and kernel modules. The /lib directory contains runtime libraries that are essential for system functionality.

  1. /etc (Configuration Files):

Contains configuration files and directories that store system-wide configuration settings for various applications and services.

  1. /dev (Device Files):

Contains special files that represent devices, such as hard drives, printers, and terminal devices. These files are used by the system to communicate with hardware.

8. /proc (Process Information):

A virtual file system that provides information about running processes and system status. The files and directories in /proc are not actual files but provide a way to access kernel and process-related information.

9. /var (Variable Files):

Contains variable data files, including log files, temporary files, spool directories for printing, and more. This directory is often used to store data that can change during system operation.

10. /tmp (Temporary Files):

A location for temporary files created by various applications. Files in /tmp are usually deleted when the system reboots.

11. /home (Home Directories):

Contains user home directories, where users store their files and configurations.

12. /boot (Boot Loader Files):

Contains boot loader-related files and the Linux kernel, which is essential for system booting.

13. /media and /mnt (Mount Points):

Directories where external devices, such as USB drives and network shares, are typically mounted.

  1. /opt (Optional Software):

Used for installing third-party software that is not part of the distribution’s package management system.

15. /srv (Service Data):

Contains data for services provided by the system, such as web server content or data files shared over a network.

16. /usr/local (Local Software):

Contains locally installed software that is not managed by the distribution’s package manager.

This is just a brief overview of the Linux File System Hierarchy. Each directory serves a specific purpose in organizing system files, user data, and configurations. Understanding this hierarchy can help you navigate and manage your Linux system effectively.

BASIC COMMANDS OF LINUX.

Let’s dive into some essential Linux commands that will help you navigate and interact with the system:

a. pwd (Print Working Directory): This command shows you the current directory you are in.

b. ls (List): List the contents of the current directory.

ls
ls -l  # Detailed list
ls -a  # Show hidden files

c. cd (Change Directory): Move to a different directory.

cd Documents
cd ..  # Move to parent directory
cd /   # Move to root directory

d. mkdir (Make Directory): Create a new directory.

mkdir new_directory

e. touch: Create an empty file or update the timestamp of an existing file.

touch new_file.txt

f. rm (Remove): Delete files or directories. Use with caution, as it is irreversible.

rm file.txt
rm -r directory  # Remove a directory and its contents

g. cp (Copy): Copy files and directories.

cp file.txt new_location/
cp -r directory new_location/  # Copy a directory and its contents

h. mv (Move): Move or rename files and directories.

mv file.txt new_location/
mv old_name.txt new_name.txt

i. cat (Concatenate): Display the content of a file.

cat file.txt

j. grep (Global Regular Expression Print): Search for patterns in files.

grep "pattern" file.txt

k. chmod (Change Mode): Change file permissions.

chmod +x script.sh  # Add execute permission

l. ps (Process Status): List the running processes.

ps aux

m. kill: Terminate running processes.

kill PID

n. chmod(Change Mode): Changes file permissions.

chown new_owner file.txt

Examples of Using the cat command.

File Operations.

1. To create a file in Linux:

# cat > filename (say nazfile)
Hello World
Ctrl+d (To save the file)

2. To display the content of the file:

# cat filename (say nazfile)

3. To append the data in the already existing file:

# cat >> nazfile
Ctrl+d (to save the changes)

4. Creating multiple files at the same time using the touch command:

#touch <filename> <filename> <filename>
#touch file1 file2 file3
Note: to check the files use # ls command

5. Renaming a file:

#mv <old name> <new name>
#mv nazfile kernelfile
  1. Removing a File:
#rm filename
Without Prompting: #rm –f filename

Directory Operations.

1. Creating a Directory:

#mkdir <dir name>
#mkdir nazdir

2. Making multiple directories inside a directory:

Let us make some directories according to the following architecture in one command;

advlinux linuxclstr hacmp lpar san netapp
#mkdir –p
{Linux/{advlinux,linuxclstr}, Aix/{hacmp,lpar}, Storage/{san,netapp}}
Note: Check it by using tree command or ls –R command

3. Copying files into directory:

#cp <source filename> <destination directory>
#cp nazfile nazdir

4. Copying directories from one location to another:

# cp –rvfp <dir name> <destination directory>
#cp –rvfp nazdir2 nazdir

5. Moving files from one location to another (cut and Paste):

#mv <filename> <destination directory>
#mv nazfile2 nazdir

6. Moving a Directory from one location to another:

#mv <dir name> <destination dir name>
#mv nazdir nazdir2

7. Renaming a Directory:

The procedure and command for renaming the directory is the same as renaming a file.

#mv <old name> <new name>
#mv naztdir kerneldir

8. Removing an Empty directory:

#rmdir dirname
  1. Removing a directory with files or directories inside:

A dir which is having some contents inside it cannot be removed by the rmdir command. There are two ways to delete the directory with contents.

i. Remove the contents inside the directory and then run rmdir command.

ii. ii. Run #rm –rf dirname (where r stands for recursive and f stands for forcefully.

The last but one of the most important topics for this article,

LINUX PERMISSIONS AND OWNERSHIP MANAGEMENT.

Linux permissions and ownership management are critical components of preserving a Linux system’s security and integrity. They manage who has access to files, folders, and other resources, as well as what activities users can take with them. Let’s take a closer look at Linux permissions and ownership management:

FILE PERMISSIONS.

The file permission system in Linux is strong, defining access rights for users, groups, and others. File permissions are critical to the security and integrity of files and directories. Each file and directory in Linux and other Unix-like operating systems has permissions that control who can read, write, and execute it. These permissions are represented as a 10-character string broken into three groups of three characters. There are three types of permissions for each file or directory: read (r), write (w), and execute (x).

The first character represents the file type, followed by three characters representing the owner’s permissions, three characters representing the group’s permissions, and three characters representing others’ permissions.

Here’s a breakdown of what each character means:

  1. File Type:
  • -: Regular file

  • d: Directory

  • l: Symbolic link

  • b: Block device

  • c: Character device

  • p: Named pipe (FIFO)

  • s: Socket

2. Permissions:

  • r: Read permission

  • w: Write permission

  • x: Execute permission

Putting it all together, a typical permission string might look like this: drwxr-xr — .

Let’s break it down:

  • The first character indicates it’s a directory.

  • The owner has read, write, and execute permissions.

  • The group has read and executed permissions.

  • Others have read-only permissions.

To change these permissions, you can use the chmod command in the terminal. For instance, chmod 755 filename would grant read, write, and execute permissions to the owner, and read and execute permissions to the group and others.

OWNERSHIP MANAGEMENT:

In Linux, every file and directory has an owner and a group assigned to it. The owner is often the user who generated the file, and the group is a group of users who share particular access permissions. The owner and group are identified by their usernames and group names, respectively.

Managing Permissions and Ownership:

You can use the chmod command to change permissions and the chown command to change ownership. Here are some examples:

1. Changing permissions:

chmod +x file: Adds execute permission to the file.
chmod u=rw,go=r file: Sets read and write permissions for the owner and read permissions for the group and others.

2. Changing ownership:

chown newowner file: Changes the owner of the file to newowner.
chown newowner:newgroup file: Changes both the owner and group of the file.

Special Permissions:

Besides the basic permissions, Linux has special permissions that can enhance security and functionality:

Setuid (s): When applied to an executable file, it allows users to execute the file with the permissions of the file’s owner.

Setgid (s): When applied to a directory, it causes new files and subdirectories created within it to inherit the group ownership of the parent directory.

Sticky Bit (t): When applied to a directory, it prevents users from deleting or renaming files owned by other users within that directory.

Effectively managing Linux permissions and ownership guarantees that important files are safeguarded and that only authorized users may view or modify them. It’s an important aspect of keeping a Linux system secure and intact. Remember that understanding and managing file permissions is critical for keeping your Linux system secure and stable. Always use caution while modifying permissions, as incorrect modifications could jeopardize your system’s operation or security.

And we have come to the end of this article, I hope you enjoyed this value-packed article, there will be more to come but for now, let’s say our farewells.

Â