Day-3Essential commands in Linux 🧑‍💻🐧

FauzeyaFauzeya
3 min read

Table of contents

  1. History of Linux?

  2. Linux Hierarchy

  3. Basic commands

  • Linux is a free and open-source operating system that belongs to the Unix family. Linus Torvalds developed it in September 1991.

  • The initial version, Linux 0.01, was posted on the Minix newsgroup on September 17, 1991. Due to its popularity, Torvalds continued developing the code, which led to the official release of Linux version 0.02 on October 5, 1991.

  • Today, Linux is one of the most widely used operating systems, with 90% of the fastest supercomputers (including the top 10) running on various Linux variants.

Linux Hierarchy:

The Linux directory structure is organized into a tree-like hierarchy starting from the root (/). Each directory serves a specific purpose, helping to keep system files and user data organized efficiently.

  • / (Root)

    • The root directory is the base of the Linux file system. All other directories stem from here.
  • /bin (Binary)

    • Contains essential user binaries (executables) like ls, cp, and mkdir.
  • /sbin (System Binary)

    • Holds essential system binaries used for system administration, such as ifconfig, reboot.
  • /etc (Configuration)

    • Stores configuration files for the system and services. For example, /etc/passwd for user information.
  • /home (Home Directory)

    • Contains personal directories for users, like /home/username. Each user stores personal files here.
  • /var (Variable)

    • Holds files that are expected to grow dynamically, such as logs (/var/log), caches, and temporary files.
  • /tmp (Temporary)

    • Stores temporary files created by applications. Files here may be deleted automatically after a reboot.
  • /usr (User Binaries and Programs)

    • Contains user-installed software and utilities. Subdirectories like /usr/bin, /usr/lib hold binaries and libraries for programs.
  • /opt (Optional)

    • Used to install additional third-party software.
  • /dev (Device Files)

    • Contains special files that represent hardware devices (e.g., /dev/sda1 for a hard drive).
  • /mnt and /media (Mount Points)

    • Used as mount points for temporary media, like USB drives or CDs.
  • /lib (Libraries)

    • Contains shared libraries required by binaries in /bin and /sbin.
  • /proc (Process Information)

    • A virtual filesystem that provides system information and running processes, like /proc/cpuinfo.
  • /boot (Boot Loader Files)

    • Contains boot loader files, like the kernel and grub.
  • /root (Root User's Home)

    • The home directory for the root user is separate from other users’ home directories.

Basic Commands

  • clear → it is used for clear screen

  • whoami → it shows the current login user name

  • history → it shows a list of previously used commands

  • date → it shows the time and date

  • df-h → it shows the disk space usage of a system

  • free -h → it shows the memory usage of a system

ls option_flag arguments --> List the sub-directories and files available in the present directory

  • ls -l--> List the files and directories in a long list format with extra information

  • ls -a --> List all including hidden files and directory

  • ls *.sh --> List all the files having .sh extension.

  • ls -i --> List the files and directories with index numbers Inodes

  • ls -d */ --> list only directories.(we can also specify a pattern)

Directory commands

  • pwd --> print work directory. Gives the present working directory.

  • cd path_to_directory --> Change the directory to the provided path

  • cd ~ or just cd --> change directory to the home directory

  • cd - --> Go to the last working directory.

  • cd .. --> Change the directory to one step back.

  • cd ../.. --> Change directory to 2 levels back.

  • mkdir directoryName --> To make a directory in a specific location

Next, I’ll dive deeper into process management and other essential Linux commands to further strengthen my DevOps toolkit!

Stay tuned for more updates!🔍🚀Uncover the Beginnings of Linux

10
Subscribe to my newsletter

Read articles from Fauzeya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Fauzeya
Fauzeya

Hi there! I'm Fauzeya 👩‍💻, a passionate DevOps Engineer with a background in Computer Science Engineering🎓. I’m committed to enhancing security🔒, efficiency⚙️, and effectiveness in software development and deployment processes. With extensive knowledge in cloud computing☁️, containerization📦, and automation🤖, I aim to stay updated with the latest tools and methodologies in the DevOps field. Currently, I’m on a journey to deepen my understanding of DevOps I enjoy sharing my learning experiences and insights through my blog, 📝where I cover topics related to DevOps practices, tutorials, and challenges. I believe in continuous growth and learning and am excited to connect with fellow tech enthusiasts and professionals🤝. Let’s embark on this journey together!🚀