About Linux Everything You Need to Know

What is Linux?

Linux, an open-source and community-developed operating system. It is similar to Unix and is designed for various platforms. Its include computers, servers, mainframes, and mobile devices.

Unlike Unix, Linux is not derived from Unix but rather built from scratch. A Linux distribution comprises the Linux kernel and a collection of software, forming a complete operating system.

Key Linux Advantages:

  • Linux is open source, offering a free codebase for creating custom operating systems.
  • It prioritizes security, making it more resilient to hacking compared to Windows.
  • The abundance of commands in Linux poses a challenge for potential hackers.
  • Software updates are easily managed in Linux.
  • Linux is lightweight, consuming minimal system resources.
  • Supports multiple users and tasks.
  1. File System Hierarchy:
    • Folders are represented as directories in Linux.
    • The administrator is often referred to as the root user.
    • Files are straightforward files.
    • Software is packaged for installation.
    • The top-level directory is represented by “/”.
    • The root user’s home directory is “/root”.
    • Other users have their home directories under “/home”.
    • Bootable files are found in “/boot”.
    • Configuration files and hardware information reside in “/etc”.
    • Installed software is typically located in “/usr”.
    • “/bin” holds commands for all users, including the root user.
    • Special commands exclusive to the root user are in “/sbin”.
    • Optional application software packages can be stored in “/opt”.
    • Essential device files are in “/dev”, encompassing terminal devices and attached hardware.

Creating Files in Linux:

  1. Using Cat:
    • The cat command in Linux serves multiple purposes: file creation, concatenation, file copying, and merging multiple files.
    • Cat creates files that are not editable once generated.
  2. Using Touch:
    • To generate empty files in Linux, the touch command is employed.
    • Touch can also modify file timestamps, including access and modification times.
  3. Vi/Vim Text Editor:
    • Vi/Vim is a robust text editor preferred by programmers, ideal for editing plain text and Unix programs.
    • Vi/Vim’s power surpasses that of Nano, making it accessible on most Linux distributions.
  4. Nano Editor:
    • Nano, a user-friendly text editor, provides a simpler alternative to Vi/Vim.

File and Directory Removal Commands:

  • rmdir: Removes empty directories.
  • rmdir -p: Deletes both parent and child directories.
  • rmdir -pv: Eliminates parent and subdirectories along with any contents they hold.
  • rm -rf: Efficiently removes even non-empty files and directories.
  • rm -rp: Deletes non-empty directories, including parent and subdirectories.

(Note: rmdir is for directories, while rm is for files.)

Basic Linux Commands:

  • Hostname: This command reveals the machine type and system version.
  • ifconfig: Provides information about the machine’s IP addresses.
  • yum: Used for managing software packages, allowing installation, uninstallation, and updates.
  • which: Checks the installation status of a specific package.
  • whoami: Identifies the current user, verifying if they have root privileges.
  • echo: Displays text or strings passed as arguments.
  • useradd: Adds a new user to the system.
  • cat /etc/passwd: Locates the file containing information about added users.
  • groupadd: Used for creating user groups.
  • cat /etc/group: Reveals the location of the group file.
  • gpasswd -a: Adds a single user to a group.
  • gpasswd -M: Appends multiple users to a group.
  • ln: Generates a duplicate of an original file.
  • ln -s: Creates a symbolic link or shortcut for a file.
  • tar: Acts as an archiver, combining multiple files into one, similar to a ZIP file in Windows.
  • chmod: Alters file access permissions.
  • chown: Changes the file or directory owner.
  • chgrp: Modifies the group ownership of files or directories.
  • grep: Searches for specific words within files.
  • Sort: Arranges items in ascending order.
  • q: Quits the current program.
  • The df command is used to display information about disk space usage on your system. It provides data on available and used disk space for mounted file systems.
  • du helps you find out how much disk space a file or directory occupies. It can be used to assess storage consumption for specific files and folders.
  • ps is used to list running processes on your Linux system. It provides information about the processes, including their process IDs (PIDs), memory usage, and more.
  • The top command offers a dynamic, real-time view of system processes. It displays information on CPU and memory usage, as well as system load.
  • The free command provides details about system memory (RAM) usage. It reports on available, used, and cached memory, which is valuable for monitoring system performance.
  • shutdown is used to shut down or restart the system. It allows users to control system power management safely.
  • The reboot command is a quick way to restart the system. It’s useful after making system changes that require a reboot to take effect.
  • passwd allows users to change their passwords. It is used for managing user account security.
  • The history command shows a list of previously executed commands in the terminal, making it easier to recall and reuse past commands.
  • date displays the current date and time. It can also be used to set the system’s date and time.
  • The find command is used for searching files and directories based on various criteria like file name, size, and modification time.
  • wget is a command-line utility for downloading files from the internet. It’s commonly used to fetch files and content from web servers.
  • grep is used for searching text within files. It’s particularly handy for finding specific patterns or keywords within text files.
  • curl is another command-line tool for transferring data with URLs. It can be used for downloading, uploading, and interacting with web services.
  • ssh enables secure remote access to other systems or servers. It’s crucial for secure communication and remote management.
  • The tar command is used for archiving and compressing files or directories. It’s frequently used for creating backups and managing large sets of files.

In conclusion, Linux is a versatile and powerful open-source operating system that has evolved over the years to become a modern computing. Its community-driven development, security features, and vast array of software make it a wide range of applications, from server environments to personal desktops and mobile devices. Linux’s robust file system hierarchy, diverse command-line utilities, and user-friendly graphical interfaces make it accessible to users with varying levels of technical expertise. Whether you are a seasoned IT professional, a developer, or simply a curious user, Linux offers a wealth of possibilities and a supportive community that continues to foster innovation and growth. As technology advances, Linux remains a dynamic and enduring force in the world of operating systems mostly used in Cyber Security.

Add a Comment

Your email address will not be published. Required fields are marked *