Gathering system information

Collecting information about the current system from the command line is very important in logging system data. The different system information data includes hostname, kernel version, Linux distro name, CPU information, memory information, disk partition information, and so on. This recipe will show you different sources in a Linux system to gather information about the system.

How to do it...

  1. In order to print the hostname of the current system, use:
    $ hostname
    

    Or:

    $ uname -n
    
  2. Print long details about the Linux kernel version, hardware architecture, and more by using:
    $ uname -a
    
  3. In order to print the kernel release, use:
    $ uname -r
    
  4. Print the machine type as follows:
    $ uname -m
    
  5. In order to print details about the CPU, ...

Get Linux Shell Scripting Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.