From 531328fc533df37dbeb5d9ba66092e545fe90f3b Mon Sep 17 00:00:00 2001 From: medusa Date: Fri, 5 Jan 2024 15:23:00 +0000 Subject: [PATCH] Add docs/tech_docs/Linux-commands.md --- docs/tech_docs/Linux-commands.md | 249 +++++++++++++++++++++++++++++++ 1 file changed, 249 insertions(+) create mode 100644 docs/tech_docs/Linux-commands.md diff --git a/docs/tech_docs/Linux-commands.md b/docs/tech_docs/Linux-commands.md new file mode 100644 index 0000000..8a8a81e --- /dev/null +++ b/docs/tech_docs/Linux-commands.md @@ -0,0 +1,249 @@ +# Linux `ls*` Commands Reference Guide + +## File and Directory Listing +- **ls**: List files and directories + - `-l`: Long format + - `-a`: Include hidden files + - `-h`: Human-readable file sizes + +## Hardware and System Information +- **lsblk**: List block devices (hard drives, SSDs, USB drives) +- **lscpu**: Display CPU architecture information (CPUs, cores, threads, CPU family, model) +- **lsmod**: List currently loaded kernel modules +- **lspci**: Show details about PCI buses and devices (graphics cards, network adapters) +- **lsusb**: List USB devices + +## System Configuration and Status +- **lsb_release**: Display Linux distribution information (distributor ID, description, release number, codename) +- **lslogins**: Display user information (login name, UID, GID, home directory, shell) +- **lsof**: List open files by processes (including files, directories, network sockets) +- **lsattr**: Display file attributes on a Linux second extended file system (immutable, append only, etc.) +- **lsns**: List information about namespaces +- **lsmem**: Show memory range available in the system + +## Usage +Each command can be explored further with its man page, for example, `man lsblk`. + +> Note: This guide is a quick reference and does not cover all available options and nuances of each command. + +--- + +# Linux System Administration Command Sets + +## System Monitoring Commands +- **top**: Displays real-time system stats, CPU, memory usage, and running processes. +- **htop**: An interactive process viewer, similar to top but with more features. +- **vmstat**: Reports virtual memory statistics. +- **iostat**: Provides CPU and input/output statistics for devices and partitions. +- **free**: Shows memory and swap usage. +- **uptime**: Tells how long the system has been running. + +## Network Management Commands +- **ifconfig**: Configures and displays network interface parameters. +- **ip**: Routing, devices, policy routing, and tunnels. +- **netstat**: Displays network connections, routing tables, interface statistics. +- **ss**: Utility to investigate sockets. +- **ping**: Checks connectivity with a host. +- **traceroute**: Traces the route taken by packets to reach a network host. + +## Disk and File System Management +- **df**: Reports file system disk space usage. +- **du**: Estimates file and directory space usage. +- **fdisk**: A disk partitioning tool. +- **mount**: Mounts a file system. +- **umount**: Unmounts a file system. +- **fsck**: Checks and repairs a Linux file system. +- **mkfs**: Creates a file system on a device. + +## Security and User Management +- **passwd**: Changes user passwords. +- **chown**: Changes file owner and group. +- **chmod**: Changes file access permissions. +- **chgrp**: Changes group ownership. +- **useradd/userdel**: Adds or deletes users. +- **groupadd/groupdel**: Adds or deletes groups. +- **sudo**: Executes a command as another user. +- **iptables**: Administration tool for IPv4 packet filtering and NAT. + +## Miscellaneous Useful Commands +- **crontab**: Schedule a command to run at a certain time. +- **grep**: Searches for patterns in files. +- **awk**: Pattern scanning and processing language. +- **sed**: Stream editor for filtering and transforming text. +- **find**: Searches for files in a directory hierarchy. +- **tar**: Archiving utility. +- **wget**: Retrieves files from the web. + +> Note: This is a basic overview of some essential system administration commands. Each command has its specific options and uses, which can be explored further in their man pages (e.g., `man top`). + +--- + +# Expanded Linux System Administration Command Sets + +## System Monitoring Commands +- **top**: Displays real-time system stats, CPU, memory usage, and running processes. Interactive controls to sort and manage processes. +- **htop**: An enhanced interactive process viewer, similar to top but with more features, better visual representation, and customization options. +- **vmstat**: Reports virtual memory statistics, including processes, memory, paging, block IO, traps, and CPU activity. +- **iostat**: Provides detailed CPU and input/output statistics for devices and partitions, useful for monitoring system input/output device loading. +- **free**: Shows the total amount of free and used physical and swap memory in the system, and the buffers and caches used by the kernel. +- **uptime**: Tells how long the system has been running, including the number of users and the system load averages for the past 1, 5, and 15 minutes. + +## Network Management Commands +- **ifconfig**: Configures and displays network interface parameters. Essential for network troubleshooting and configuration. +- **ip**: A versatile command for routing, devices, policy routing, and tunnels. Replaces many older commands like ifconfig. +- **netstat**: Displays network connections (both incoming and outgoing), routing tables, and a number of network interface statistics. +- **ss**: A utility to investigate sockets, can display more detailed network statistics than netstat. +- **ping**: Checks connectivity with a host, measures the round-trip time for messages sent to the destination. +- **traceroute**: Traces the route taken by packets to reach a network host, helps in determining the path and measuring transit delays. + +## Disk and File System Management +- **df**: Reports the amount of disk space used and available on file systems. +- **du**: Provides an estimation of file and directory space usage, can be used to find directories consuming excessive space. +- **fdisk**: A disk partitioning tool, useful for creating and manipulating disk partition tables. +- **mount/umount**: Mounts or unmounts file systems. +- **fsck**: Checks and repairs a Linux file system, typically used for fixing unclean shutdowns or system crashes. +- **mkfs**: Creates a file system on a device, usually used for formatting new partitions. +- **lvextend/lvreduce**: Resize logical volume sizes in LVM. + +## Security and User Management +- **passwd**: Changes user account passwords, an essential tool for managing user security. +- **chown**: Changes the user and/or group ownership of a given file, directory, or symbolic link. +- **chmod**: Changes file access permissions, essential for managing file security. +- **chgrp**: Changes the group ownership of files or directories. +- **useradd/userdel**: Adds or deletes user accounts. +- **groupadd/groupdel**: Adds or deletes groups. +- **sudo**: Executes a command as another user, fundamental for privilege escalation and user command control. +- **iptables**: An administration tool for IPv4 packet filtering and NAT, crucial for network security. + +## Miscellaneous Useful Commands +- **crontab**: Manages cron jobs for scheduling tasks to run at specific times. +- **grep**: Searches text or files for lines containing a match to the given strings or patterns. +- **awk**: A powerful pattern scanning and processing language, used for text/data extraction and reporting. +- **sed**: A stream editor for filtering and transforming text. +- **find**: Searches for files in a directory hierarchy, highly customizable search criteria. +- **tar**: An archiving utility, used for storing and extracting files from a tape or disk archive. +- **wget/curl**: Retrieves content from web servers, essential for downloading files or querying APIs. + +## System Information and Configuration +- **uname**: Displays system information, such as the kernel name, version, and architecture. +- **dmesg**: Prints or controls the kernel ring buffer, useful for diagnosing hardware and driver issues. +- **sysctl**: Configures kernel parameters at runtime, crucial for system tuning and security parameter settings. +- **env**: Displays the environment variables, useful for scripting and troubleshooting environment-related issues. + +> Note: This guide provides a more detailed overview of essential commands for system administration. For in-depth information and additional options, refer to the respective command's manual page (e.g., `man sysctl`). + +--- + +# Expanded Linux System Administration Command Sets + +## System Monitoring Commands +- **top**: Displays real-time system stats, CPU, memory usage, and running processes. +- **htop**: An interactive process viewer, similar to top but with more features. +- **vmstat**: Reports virtual memory statistics. +- **iostat**: Provides CPU and input/output statistics for devices and partitions. +- **free**: Shows memory and swap usage. +- **uptime**: Tells how long the system has been running. + +## Network Management Commands +- **ifconfig**: Configures and displays network interface parameters. +- **ip**: Routing, devices, policy routing, and tunnels. +- **netstat**: Displays network connections, routing tables, interface statistics. +- **ss**: Utility to investigate sockets. +- **ping**: Checks connectivity with a host. +- **traceroute**: Traces the route taken by packets to reach a network host. + +## Disk and File System Management +- **df**: Reports file system disk space usage. +- **du**: Estimates file and directory space usage. +- **fdisk**: A disk partitioning tool. +- **mount/umount**: Mounts or unmounts file systems. +- **fsck**: Checks and repairs a Linux file system. +- **mkfs**: Creates a file system on a device. +- **lvextend/lvreduce**: Resize logical volume sizes in LVM. + +## Security and User Management +- **passwd**: Changes user passwords. +- **chown**: Changes file owner and group. +- **chmod**: Changes file access permissions. +- **chgrp**: Changes group ownership. +- **useradd/userdel**: Adds or deletes users. +- **groupadd/groupdel**: Adds or deletes groups. +- **sudo**: Executes a command as another user. +- **iptables**: Administration tool for IPv4 packet filtering and NAT. + +## Miscellaneous Useful Commands +- **crontab**: Schedule a command to run at a certain time. +- **grep**: Searches for patterns in files. +- **awk**: Pattern scanning and processing language. +- **sed**: Stream editor for filtering and transforming text. +- **find**: Searches for files in a directory hierarchy. +- **tar**: Archiving utility. +- **wget/curl**: Retrieves content from web servers. + +## System Information and Configuration +- **uname**: Displays system information. +- **dmesg**: Prints or controls the kernel ring buffer. +- **sysctl**: Configures kernel parameters at runtime. +- **env**: Displays the environment variables. + +## Usage +Each command can be explored further with its man page, for example, `man top`. + +> Note: This guide is a quick reference and does not cover all available options and nuances of each command. + +--- + +# Essential Linux Packages for RHEL and Debian-Based Systems + +## Core Utilities +- **coreutils**: Provides basic file, shell, and text manipulation utilities like `ls`, `cat`, `rm`, `cp`, and `chmod`. +- **bash**: The GNU Bourne Again shell, a key component of the Linux system, providing the command-line environment. +- **sed**: A stream editor for filtering and transforming text in a scriptable way. +- **grep**: A utility for searching plain-text data for lines matching a regular expression. +- **awk**: A powerful text processing scripting language. + +## System Management +- **systemd**: A system and service manager for Linux, compatible with SysV and LSB init scripts. +- **NetworkManager**: Provides network connection management and configuration. +- **firewalld/iptables**: Tools for managing network firewall rules. +- **SELinux**: Security-Enhanced Linux, a security module for enforcing mandatory access control policies. + +## Package Management +- **yum/dnf** (RHEL): Command-line package management utilities for RHEL and derivatives. +- **apt/apt-get** (Debian): Advanced Package Tool for managing packages on Debian-based systems. + +## Development Tools +- **build-essential** (Debian): A meta-package that installs GCC, Make, and other utilities essential for compiling software. +- **Development Tools** (RHEL): A package group that includes basic development tools like GCC, Make, and others. + +## Compression and Archiving +- **tar**: An archiving utility for storing and extracting files. +- **gzip/bzip2/xz**: Compression tools used to reduce the size of files. + +## Networking Utilities +- **net-tools**: Provides basic networking tools like `ifconfig`, `netstat`, `route`, and `arp`. +- **openssh**: Provides secure shell access and SCP file transfer. +- **curl/wget**: Command-line tools for transferring data with URL syntax. +- **rsync**: A utility for efficiently transferring and synchronizing files. + +## File System Utilities +- **e2fsprogs**: Utilities for the ext2, ext3, and ext4 file systems, including `fsck`. +- **xfsprogs**: Utilities for managing XFS file systems. +- **dosfstools**: Utilities for making and checking MS-DOS FAT filesystems on Linux. + +## Text Editors +- **vim**: An advanced text editor that seeks to provide the power of the de facto Unix editor 'Vi', with a more complete feature set. +- **nano**: A simple, easy-to-use command-line text editor. + +## Security Utilities +- **openssh-server**: Provides the SSH server component for secure access to the system. +- **openssl**: Toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols. + +## Monitoring Tools +- **htop**: An interactive process viewer, more powerful than `top`. +- **nmon**: Performance monitoring tool for Linux. +- **iotop**: A utility for monitoring disk IO usage by processes. + +> Note: This guide provides a basic overview of essential Linux packages for system administration on RHEL and Debian-based systems. Each package's specific functionality can be explored further in its documentation or man page. + +--- \ No newline at end of file