How to Get Information About Your Linux System Through the Command Line

Whether you’ve just gained access to a new Linux system, ethically hacked into one as part of a security test, or you’re just curious to know more about your current machine, this article will guide you through the process. You’ll learn how you can g...

Jun 11, 2025 - 18:50
 0
How to Get Information About Your Linux System Through the Command Line

Whether you’ve just gained access to a new Linux system, ethically hacked into one as part of a security test, or you’re just curious to know more about your current machine, this article will guide you through the process.

You’ll learn how you can get information related to your OS (operating system), kernel, CPU, memory, processes, disks, networks, and installed software. You’ll explore the commands and their outputs in detail.

Table of Contents

Why It's Important to Understand Your Linux System

System Administration

System administrators need to have an understanding of the system so they are able to:

  • Manage users, groups, and permissions effectively.

  • Configure services like web servers, databases, and so on.

  • Automate repetitive tasks with scripts and cron jobs.

Troubleshooting

When the system is in a problematic state, a solid understanding of the system specification and configuration helps you to:

  • Identify and resolve system errors quickly.

  • Analyze system logs and monitor performance.

  • Diagnose network and hardware issues.

Security Auditing

If you are in a security related role, knowing your system in depth helps you to:

  • Monitor logs for unauthorized access.

  • Configure firewalls and security policies.

  • Detect and remove malicious processes or software.

Performance Optimization

If you know how to gather information related to system resources, you can measure them and create a projection for the future use. You can also:

  • Tune system parameters for better efficiency.

  • Monitor resource usage (CPU, memory, disk, I/O).

  • Eliminate bottlenecks and optimize workloads.

Proactive Maintenance

It is a good practice to be able to prevent issues before they occur. Once you know your system well, you can:

  • Schedule regular updates and backups.

  • Ensure system reliability and uptime.

Understanding your Linux system gives you greater control, enhances system stability, and improves your overall effectiveness as a system administrator or power user.

In the next section, we’ll discuss some essential commands for gathering system information.

How to Get Your OS & Kernel Information in Linux

uname -a Command

uname -a provides full kernel information:

uname -a
Linux ip-172-31-90-178 6.8.0-1024-aws #26-Ubuntu SMP Tue Feb 18 17:22:37 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Here is what each part means in the above command:

  • Linux: The kernel name.

  • ip-172-31-90-178: The network hostname of the system.

  • 6.8.0-1024-aws: The kernel version and AWS-specific build.

  • #26-Ubuntu: The kernel build number.

  • SMP: Symmetric Multi-Processing, indicating that the kernel is compiled for multiple processors.

  • Tue Feb 18 17:22:37 UTC 2025: The date and time when the kernel was compiled.

  • x86_64 x86_64 x86_64: The machine hardware name (architecture), processor type, and platform type, all indicating 64-bit x86 architecture.

  • GNU/Linux: The operating system name.

Based on this output, I’m running on an AWS EC2 instance with a 64-bit Ubuntu Linux distribution using a kernel that was specifically built for AWS infrastructure.

uname -r and uname -s Commands

The uname -r and uname -s commands specify the kernel version and OS type information:

uname -r
6.11.0-25-generic

uname -s
Linux

cat /etc/os-release Command

The cat /etc/os-release command provides distribution information:

cat /etc/os-release
PRETTY_NAME="Ubuntu 24.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.2 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo

Here is what each part means in the above command:

  • PRETTY_NAME="Ubuntu 24.04.2 LTS": The user-friendly name of the distribution including version and LTS (Long Term Support) designation.

  • NAME="Ubuntu": The name of the Linux distribution.

  • VERSION_ID="24.04": The version number of the Ubuntu release (Year/Month format).

  • VERSION="24.04.2 LTS (Noble Numbat)": The complete version information including:

    24.04: Major version (released April 2024)

    .2: Point release number

    LTS: Long Term Support

    Noble Numbat: The release codename

  • VERSION_CODENAME=noble: The codename for this Ubuntu release ("Noble").

  • ID=ubuntu: The machine-readable name of the operating system.

  • ID_LIKE=debian: Indicates that Ubuntu is based on Debian Linux.

  • HOME_URL, SUPPORT_URL, BUG_REPORT_URL, PRIVACY_POLICY_URL : Various official URLs for Ubuntu resources.

  • UBUNTU_CODENAME=noble: Reiterates the codename of this Ubuntu release.

  • LOGO=ubuntu-logo: Specifies the logo identifier for the distribution.

This output shows that I’m running Ubuntu 24.04.2 LTS (codenamed "Noble Numbat"), which is a Long Term Support release of Ubuntu. Being an LTS version means it will receive security updates and support for an extended period (typically 5 years for Ubuntu LTS releases).

hostnamectl Command

hostnamectl shows the hostname, OS, and kernel info:

hostnamectl
 Static hostname: ip-172-31-90-178
       Icon name: computer-vm
         Chassis: vm