System information Linux commands are commands that are used to gather information about the system, such as its hardware components, memory usage, disk space utilization, etc.
Here are some common Linux commands used to gather system information:
uname
The uname command is used to display information about the Linux operating system and its underlying system information, including the name, version, and architecture.
Here's the basic syntax of the uname command:
Where [OPTION] is one or more of the following options:
- -a: Display all information about the system, including the name, version, release, and machine architecture.
- -m: Display the machine hardware name.
- -n: Display the hostname of the system.
- -r: Display the Linux kernel release version.
- -s: Display the name of the operating system.
- -p: Display the processor type.
- -v: Display the Linux kernel version.
Example usage:
Calling uname without any options will return the Operating System codename:
To display all information about the system, including the name, version, release, and machine architecture.
To display the machine hardware name, e.g. x86_64 for a 64-bit system.
To display the hostname of the system.
lsb_release
The lsb_release command is used to display information about the Linux distribution and its version.
Here's the basic syntax of the lsb_release command:
Where [OPTION] is one or more of the following options:
- -a: Display all information about the distribution, including the name, description, and release version.
- -d: Display the description of the distribution.
- -i: Display the distribution ID.
- -r: Display the release version of the distribution.
- -s: Display a short description of the distribution.
Example usage:
To display all information about the distribution, including the name, description, and release version.
This command displays a short description of the distribution:
cat /proc/version
The /proc/version file is a virtual file in the /proc file system that provides information about the Linux kernel version that is running on the system. The cat command can be used to display the contents of this file.
The output of the cat /proc/version displays the following information:
- The Linux version string, which includes the Linux kernel version and the name of the distribution that is running the kernel.
- The build time and date of the Linux kernel.
- The name and email address of the person who built the Linux kernel.
Example usage:
To display the information about the Linux kernel version and builds information use the following command:
In this example, the Linux kernel version is 4.15.0-88-generic, and the distribution that is running the kernel is Ubuntu 18.04.1.
cat /proc/cpuinfo
The /proc/cpuinfo file is a virtual file in the /proc file system that provides information about the central processing unit (CPU) in the system. The cat command can be used to display the contents of this file.The output of cat /proc/cpuinfo displays information about each processor in the system, including:
- Processor vendor and model name.
- Processor clock speed.
- Cache size.
- Processor flags, which represent features that the processor supports.
Example usage:
This command displays information about the central processing unit (CPU) in the system.
Here's a sample output of cat /proc/cpuinfo:
In this example, the system has an Intel core i5 4th Gen processor. The processor clock speed is 1.90 GHz and the cache size is 3072 KB.
cat /proc/meminfo
The /proc/meminfo file is a virtual file in the /proc file system that provides information about the memory usage and statistics of the system. The cat command can be used to display the contents of this file.
The output of cat /proc/meminfo displays information about the system's memory usage, including:
- Total installed memory (MemTotal).
- Free memory is available (MemFree).
- Buffered memory is used by the kernel (Buffers).
- Cached memory is used by the kernel (Cached).
- Total swap space (SwapTotal).
- Free swap space (SwapFree).
Example usage:
To display the information about the memory usage and statistics of the system. Here's a sample output of cat /proc/meminfo:
In this example, the system has a total of 1511588 KB of memory, with 439024 KB of free memory available. The system also has a total of 1139848 KB of swap space, with 699344 KB of cache space.
df
The df command is used to display information about disk space usage on a file system.By default, df displays the disk space usage information for all mounted file systems in the system. Each file system is displayed on a separate line, with columns indicating the following information:
- Filesystem: the type of file system.
- 1K-blocks: the total size of the file system in 1KB blocks.
- Used: the amount of disk space used by the file system.
- Available: the amount of disk space available on the file system.
- Use%: the percentage of disk space used.
- Mounted on: the mount point of the file system.
Example usage:
This command displays the disk space usage information for all mounted file systems in the system. Here's a sample output of df:
In this example, the system has two file systems, /dev/sda1 and /dev/sdb1, mounted at the root directory (/) and the /data directory, respectively.
free
The free command is used to display information about the total amount of physical memory and swap memory available, as well as the amount of memory being used and the amount of memory available for processes to allocate.
By default, free displays information in a table format, with columns indicating the following information:
- total: the total amount of physical memory or swap memory available.
- used: the amount of physical memory or swap memory being used.
- free: the amount of physical memory or swap memory available for processes to allocate.
- shared: the amount of physical memory shared between processes.
- buffers: the amount of physical memory used as buffers.
- cache: the amount of physical memory used as a cache.
- available: the amount of physical memory available to allocate to running processes, taking into account cache and buffers.
Example usage:
This command displays the information about the total amount of physical memory and swap memory available, as well as the amount of memory being used and the amount of memory available for processes to allocate. Here's a sample output for free:
In this example, the system has 1511588 KB of physical memory, and 1535360 KB of swap memory. Of the physical memory, 197620 KB is being used, 0 is free, 3368 KB is shared, and 876660 KB is used as buffers/cache. The available column shows 1138800 KB of physical memory available to allocate to running processes, taking into account cache and buffers.
top
The top command is used to display the processes currently running on a Linux system, and information about the system resources being used. It is a dynamic, real-time view of the system's processes and resource usage.
By default, the top displays information about the following:
- Current system uptime.
- The number of users logged into the system.
- Load average: an indicator of system activity, represented by three values representing the average number of system processes over the past 1, 5, and 15 minutes.
- The total number of tasks (processes) running and the number of tasks in each process state (running, sleeping, stopped, etc.).
- Physical memory usage and swap memory usage.
- The list of processes is sorted by CPU usage. For each process, the top displays the following information:
- Process ID (PID).
- The user running the process.
- CPU usage percentage.
- Memory usage.
- Command name.
Example usage:
To display the real-time view of the processes running on the system and information about the system resources being used.
Here's a sample output of the top:
In this example, the system has been up for 3:25 minutes. The load average is 0.10, 0.05, and 0.01 for the past 1, 5, and 15 minutes, respectively. There are 110 tasks running, with 1 task running and 77 tasks sleeping. 99.5% of the CPU is idle. The system has 1511588 KB of physical memory and 1535360 KB of swap memory. The first process listed, with PID 819, is using 0.3% of the CPU and 3.2% of the memory, and has been running for 0:24:15. The second process listed, with PID 1, is using 0.0% of the CPU and 0.6% of the memory, and has been running for 0:01:27.
htop
'htop' is a system monitoring tool for Linux that provides a real-time, interactive overview of the processes running on a system. It provides information on the system's performance, including CPU usage, memory usage, and other statistics. Here are some of the key features of 'htop':
- User-friendly interface: 'htop' provides a visually appealing and easy-to-use interface compared to the standard 'top' command.
- Color coding: Different process states, such as running, sleeping, or stopping, are color-coded to make it easier to distinguish between processes.
- Sortable columns: 'htop' allows you to sort the process list by multiple criteria, such as CPU usage, memory usage, and process ID.
- Detailed process information: 'htop' provides a detailed process information screen that can be accessed by selecting a process with the cursor. This screen provides information on the process's status, memory usage, and other statistics.
- Process tree view: 'htop' displays a process tree view that shows the relationships between processes and the parent-child relationships between processes.
- Real-time updates: 'htop' updates its display in real-time, allowing you to see changes in system performance as they occur.
- Interactive controls: 'htop' provides interactive controls that allow you to perform actions, such as killing a process, directly from the 'htop' interface.
In summary, 'htop' is a powerful and user-friendly system monitoring tool that provides a real-time, interactive overview of the performance of a Linux system.
lscpu
The command 'iscpu' is not a standard Linux command. It appears to be a typo or a custom command that may not exist on your system.
If you were looking for information about the 'lscpu' command, it is a Linux utility that provides information about the system's CPU architecture. The information provided by 'lscpu' includes the processor type, number of cores, clock speed, and other information.
To run 'lscpu', open a terminal window and type 'lscpu', and press enter.
These commands are commonly used to gather information about the system, monitor its performance, and diagnose problems.