Introduction To Linux

Day 2 : 90Days of DevOps Challenge

ยท

5 min read

What is Linux ?

  1. Linux is an open-source operating system (OS) that is widely used in servers, desktop computers, smartphones, and other devices. Linux was created in the early 1990s by Linus Torvalds, and is based on the Unix operating system.

  2. One of the key features of Linux is its open-source nature, which means that the source code of the operating system is freely available for anyone to modify and distribute. This has led to a large community of developers and users who contribute to its development and use.

  3. Linux is known for its stability, security, and flexibility, and is popular for use in web servers, cloud computing, scientific research, and many other areas.

  4. The popularity of Linux has also led to the creation of many different distributions or versions, such as Ubuntu, Debian, and Red Hat, each with their own features and strengths.

Applications :

  1. Mobile devices:

    Android, the world's most popular mobile operating system, is based on the Linux kernel.

  2. Internet of Things (IoT):

    Linux is used in many IoT devices, such as smart thermostats, home automation systems, and industrial sensors.

  3. Security:

    Linux is often used in security-focused environments, such as network security appliances, firewalls, and intrusion detection systems.

  4. Cloud computing:

    Many cloud computing platforms, such as Amazon Web Services (AWS) and Google Cloud Platform (GCP), run on Linux servers.

Why Linux ?

  1. Open-source:

    Linux is an open-source operating system, meaning that its source code is available for anyone to use, modify, and distribute. This allows users to customize and adapt the system to their needs, and also means that Linux is often free to use.

  2. Stability and reliability:

    Linux is known for its stability and reliability, with a reputation for being less prone to crashes and errors than other operating systems.

  3. Security:

    Linux is generally considered to be more secure than other operating systems, due to its architecture and the availability of security-focused distributions.

  4. Flexibility and customizability:

    Linux is highly customizable, allowing users to choose from a wide range of distributions and software packages, and to configure the system to meet their specific needs.

  5. Performance:

    Linux is often used in high-performance computing environments, such as scientific research and supercomputing, due to its ability to handle large workloads efficiently.

  6. Community and support:

    Linux has a large and active community of users and developers, who provide support, guidance, and resources to users of all levels.

Overall, Linux offers a powerful and flexible operating system that can be tailored to meet the needs of users and organizations in a wide range of environments.

Architecture of Linux

File system hierarchy :

The Filesystem Hierarchy Standard (FHS) is a set of guidelines that define the directory structure of Linux-based operating systems. Here is a brief overview of the most important directories in the FHS hierarchy:

  1. /: The root directory, which contains all other directories and files.

  2. /bin: Contains essential system utilities and binaries, such as ls, cp, and mv.

  3. /boot: Contains the files necessary to boot the system, such as the bootloader and kernel.

  4. /dev: Contains device files for all system devices, such as /dev/sda for the first hard disk.

  5. /etc: Contains system configuration files, such as /etc/passwd for user accounts.

  6. /home: Contains user home directories.

  7. /lib: Contains shared libraries that are required by system binaries in /bin and /sbin.

  8. /media: Mount point for removable media, such as USB drives or CD/DVDs.

  9. /mnt: Mount point for temporary file systems or network shares.

  10. /opt: Contains third-party applications installed on the system.

  11. /proc: Contains system information and process-related information, presented as files and directories.

  12. /root: The home directory of the root user.

  13. /run: Contains system information that is required during the boot process.

  14. /sbin: Contains system administration binaries, such as iptables.

  15. /tmp: Contains temporary files that are created by the system or users.

  16. /usr: Contains user applications and support files, such as libraries, documentation, and development files.

  17. /var: Contains variable data files, such as log files, system databases, and spool files.

    These directories and their subdirectories provide a standardized structure for the organization of files and directories in a Linux-based operating system.

File Hierarchy Structure (FHS) in Linux

Basic Linux Commands :

  • cd - change directory

    Syntax: cd [directory_name]

    Example: cd Documents

  • ls - list files in a directory

    Syntax: ls [options] [directory_name]

    Example: ls -l /home/user

  • pwd - print working directory

    Syntax: pwd

    Example: pwd

  • mkdir - make directory

    Syntax: mkdir [directory_name]

    Example: mkdir new_directory

  • rmdir - remove directory

    Syntax: rmdir [directory_name]

    Example: rmdir old_directory

  • touch - create a new empty file or update an existing one

    Syntax: touch [filename]

    Example: touch file.txt

  • cp - copy file(s) or directory

    Syntax: cp [options] [source] [destination]

    Example: cp file1.txt /home/user/Documents

  • mv - move or rename file(s) or directory

    Syntax: mv [options] [source] [destination]

    Example: mv file.txt /home/user/Documents/new_file.txt

  • rm - remove file(s) or directory

    Syntax: rm [options] [file(s) or directory]

    Example: rm file.txt

  • cat - concatenate files and print to standard output

    Syntax: cat [filename]

    Example: cat file.txt

  • echo - print text to standard output

    Syntax: echo [text]

    Example: echo "Hello, world!"

  • chmod - change file or directory permissions

    Syntax: chmod [options] [permissions] [file(s) or directory]

    Example: chmod u+x script.sh

  • sudo - execute command as superuser (root)

    Syntax: sudo [command]

    Example: sudo apt-get update

Tasks : Day2

  1. Check your present working directory.

     $pwd
    
  2. List all the files or directories including hidden files.

     $la -a
    
  3. Create a nested directory A/B/C/D/E

     $mkdir -p A/B/C/D/E
    

Basic Hands-On Linux Commands on Terminal

(base) shivraj@Shivrajs-MacBook-Air ~ % pwd
/Users/shivraj
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications    Downloads    Movies        Public        opt
Desktop        Heart.csv    Music        Untitled.ipynb
Documents    Library        Pictures    lab1dsdb.py
(base) shivraj@Shivrajs-MacBook-Air ~ % mkdir new
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications    Downloads    Movies        Public        new
Desktop        Heart.csv    Music        Untitled.ipynb    opt
Documents    Library        Pictures    lab1dsdb.py
(base) shivraj@Shivrajs-MacBook-Air ~ % touch textfile.txt
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications    Downloads    Movies        Public        new
Desktop        Heart.csv    Music        Untitled.ipynb    opt
Documents    Library        Pictures    lab1dsdb.py    textfile.txt
(base) shivraj@Shivrajs-MacBook-Air ~ % echo "Hello Kernal"
Hello Kernal
(base) shivraj@Shivrajs-MacBook-Air ~ % rm textfile.txt
(base) shivraj@Shivrajs-MacBook-Air ~ % ls
Applications    Downloads    Movies        Public        new
Desktop        Heart.csv    Music        Untitled.ipynb    opt
Documents    Library        Pictures    lab1dsdb.py
(base) shivraj@Shivrajs-MacBook-Air ~ % pwd
/Users/shivraj
(base) shivraj@Shivrajs-MacBook-Air ~ % la -a
zsh: command not found: la
(base) shivraj@Shivrajs-MacBook-Air ~ % mkdir -p A/B/C/D/E
(base) shivraj@Shivrajs-MacBook-Air ~ % cd A
(base) shivraj@Shivrajs-MacBook-Air A % cd B
(base) shivraj@Shivrajs-MacBook-Air B % cd C
(base) shivraj@Shivrajs-MacBook-Air C % cd D 
(base) shivraj@Shivrajs-MacBook-Air D % cd E
(base) shivraj@Shivrajs-MacBook-Air E % ls
(base) shivraj@Shivrajs-MacBook-Air E % pwd
/Users/shivraj/A/B/C/D/E
(base) shivraj@Shivrajs-MacBook-Air E %

Thank You for Reading the blog ๐Ÿ‘

Keep Learning...๐Ÿ˜Š

ย