Linux System Management Commands

  • uname: View system kernel information
  • lsb_release: View Linux distribution information
  • cat /etc/os-release: View detailed system distribution information
  • lscpu: View CPU information
  • free: View memory usage statistics
  • systemctl: Manage service startup, shutdown, status checking, etc.
  • service: Manage service startup, shutdown, status checking, etc.
  • ps: View currently running processes
  • top: Monitor system processes in real-time
  • kill: Terminate a process
  • nice: Set process priority
  • yum (CentOS/RHEL): Manage software package installation, updates, and removals
  • apt-get (Ubuntu/Debian): Manage software package installation, updates, and removals
  • rpm: Manage RPM packages

Detailed Introduction

Common Linux system management commands:

  1. uname: Used to display basic information about the current system, including operating system name, kernel version, hardware architecture, etc.

    • Common options:
      • uname -s: Display the operating system name
      • uname -r: Display the kernel version
      • uname -m: Display the hardware architecture
  2. lsb_release: Used to display detailed information about the Linux distribution.

    • Common options:
      • lsb_release -a: Display all distribution information
      • lsb_release -d: Display the distribution description
      • lsb_release -c: Display the distribution codename
  3. cat /etc/os-release: Used to directly view the /etc/os-release file and obtain detailed system distribution information.

  4. lscpu: Used to display detailed CPU information, including processor model, number of cores, threads per core, clock speed, etc.

  5. free: Used to display memory usage statistics for the system, including total memory, used memory, available memory, and more.

    • Common options:
      • free -h: Display memory usage in a human-readable format
  6. systemctl: Used to manage service startup, shutdown, status checking, etc.

    • Common commands:
      • systemctl start <service_name>: Start the specified service
      • systemctl stop <service_name>: Stop the specified service
      • systemctl status <service_name>: Check the status of the specified service
  7. service: Used to manage service startup, shutdown, and status checking; functionality is similar to the systemctl command.

  8. ps: Used to display information about processes currently running on the system.

    • Common options:
      • ps -ef: Display detailed information for all processes
      • ps aux: Display all processes from a user's perspective
  9. top: Used to monitor the runtime status of system processes in real-time; allows viewing usage statistics for CPU, memory, and other system resources.

  10. kill: Used to terminate specified processes.

    • Common options:
      • kill <PID>: Terminate a process via its Process ID (PID)
      • kill -9 <PID>: Forcefully terminate a process
  11. nice: Used to adjust the priority of a process; can increase or decrease the CPU weight usage for that process.

  12. yum (CentOS/RHEL) and apt-get (Ubuntu/Debian): Used to manage software package installation, updates, and removals.

  13. rpm: Used to manage RPM packages; suitable for RPM-based distributions such as CentOS/RHEL.