Explore essential Linux system information commands, including uname, lsb_release, and more. Learn how to retrieve valuable system data and optimize your system’s performance.
Linux provides a variety of commands to gather system information.
Here are some commonly used commands to retrieve system information:
Remember that many of these commands may require super (root) privileges to access certain system information.
Additionally, the availability and behavior of these commands may vary slightly between different Linux distributions.
hostname: code example
To retrieve the hostname of a Linux system using a code example, you can use various programming languages.
Example in Python:
import socket def get_hostname(): hostname = socket.gethostname() return hostname if __name__ == "__main__": hostname = get_hostname() print("Hostname:", hostname)
Here’s how you can run the script in your terminal:
Run the script using the following command:
python get_hostname.py
It will display the hostname of your Linux system.
Here’s an example of how to use the uname command:
uname -a
For example, the output might look like this:
Linux mycomputer 5.4.0-91-generic #102-Ubuntu
SMP Fri Aug 13 16:18:06
UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Here’s an example of how to use it:
Open your terminal and run the following command:
lsb_release -a
The output might look something like this:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
Another way to display information about the Linux distribution.
cat /etc/os-release:
Here’s an example:
Open your terminal and run the following command:
cat /etc/os-release
This command will display the content of the /etc/os-release file, which may look something like this:
PRETTY_NAME=”Ubuntu 20.04.3 LTS”
NAME=”Ubuntu”
VERSION=”20.04.3 LTS (Focal Fossa)”
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”
The specific details in the output will correspond to your Linux distribution and version.
This file is a common way to obtain information about your Linux distribution programmatically.
Displays the system’s issue file, which may contain distribution-specific information.
cat /etc/issue:example
Here’s an example:
Open your terminal and run the following command:
cat /etc/issue
The output will depend on what is in the /etc/issue file on your system.
Here’s an example of what you might see:
Welcome to My Linux System
This is a customized message or banner.
You can add important information or instructions here.
The specific content of the file can vary depending on the system’s configuration and the preferences of the system administrator.
Real-time system monitoring tool showing system information and process statistics.
top:example
Here’s an example of how to use the top command:
Open your terminal.
Simply type top and press Enter.
top
The top command will start displaying a real-time, updating view of system information and processes.
Here’s a brief explanation of some of the columns you might see in the top display:
PID: Process ID.
: The who started the process.
PR: Priority of the process.
NI: The nice value of the process.
VIRT: Virtual memory used by the process.
RES: Resident (non-swapped) physical memory used by the process.
SHR: Shared memory used by the process.
S: The status of the process (e.g., R for running, S for sleeping).
%CPU: Percentage of CPU usage by the process.
%MEM: Percentage of memory usage by the process.
TIME+: Total CPU time used by the process.
COMMAND: The command that started the process.
How to Exit top command?
To exit top, you can press the q key.
You can also sort the processes by different columns by pressing the corresponding keys (e.g., press P to sort by CPU usage, M to sort by memory usage).
Here’s an example of using the top command in a Linux terminal:
Open your terminal.
Simply type top and press Enter.
top
Here’s an example of what the top display might look like:
top – 10:00:00 up 1 day, 1:30, 1 , load average: 0.00, 0.02, 0.05
Tasks: 236 total, 1 running, 235 sleeping, 0 stopped, 0 zombie
%Cpu(s): 3.2 us, 1.0 sy, 0.0 ni, 95.6 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 2048348 total, 1676684 free, 195496 used, 1731680 buff/cache
KiB Swap: 2097148 total, 2097024 free, 12384 used. 1641580 avail Mem
PID PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
997 root 20 0 394488 64516 55540 S 6.6 3.2 2:35.51 Xorg
2454 20 0 1055056 151100 38108 S 3.6 7.4 3:10.35 gnome-shell
1140 20 0 2257800 133676 50448 S 2.6 6.5 6:09.82 gnome-software
1879 20 0 1965588 110508 27180 S 2.0 5.4 3:31.18 chrome
698 20 0 584440 74864 27576 S 1.3 3.7 0:47.69 gnome-terminal
591 20 0 1725588 98372 48428 S 1.0 4.8 1:43.42 gnome-shell
htop is an interactive process viewer that provides a more detailed and -friendly representation of system information compared to top.
htop:
Here’s an example of how to use the htop command:
Open your terminal.
Simply type htop and press Enter.
htop
Here’s an example of what the htop display might look like:
1 [|||||||||||||||||||||||||||||||||||100.0%] Tasks: 38, 174 thr, 3 running
2 [||| 4.2%] Load average: 0.42 0.59 0.54
Mem[|||||||||||||||||||||||||||||1.98G/3.86G] Uptime: 0d 09:45:39
Swp[ 0K/2.00G]
PID PRI NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 4.2M 2.1M 1.1M S 0.0 0.1 19:14.47 init
2 root 20 0 0K 0K 0K S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0K 0K 0K I 0.0 0.0 0:00.01 rcu_gp
4 root 20 0 0K 0K 0K I 0.0 0.0 0:00.00 rcu_par_gp
6 root 20 0 0K 0K 0K I 0.0 0.0 0:00.01 kworker/0:0H
How to exit htop command?
Here’s an example of how to use the free command:
Open your terminal.
Simply type free and press Enter.
free
The free command will display memory statistics, including total, used, free, and cached memory.
Here’s an example of what the free display might look like:
total used free shared buff/cache available
Mem: 4048824 1242964 2471464 136044 3343962651464
Swap: 4194300 0 4194300
This will display the memory statistics in megabytes, making it easier to interpret.
Here’s an example of how to use the df command:
Open your terminal.
Simply type df and press Enter.
df
Here’s an example of what the df output might look like:
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 10321208 3350148 6434884 35% /
tmpfs 102400 4 102396 1% /dev
tmpfs 1024000 1496 1022504 1% /run
tmpfs 1024000 0 1024000 0% /dev/shm
tmpfs 1024000 0 1024000 0% /run/lock
tmpfs 1024000 0 1024000 0% /sys/fs/cgroup
In this example, the output displays information about various file systems.
The columns represent:
Filesystem: The device or partition name.
1K-blocks: The total disk space in 1-kilobyte blocks.
Used: The amount of space used.
Available: The amount of space available.
Use%: The percentage of space used.
Mounted on: The mount point of the file system.
Estimates the disk usage of files and directories.
du:example
The du (disk usage) command is used to estimate the file and directory space usage on a Linux system.
Here’s an example of how to use the du command:
Open your terminal.
To check the disk usage of a specific directory, navigate to that directory using the cd command.
For example, if you want to check the disk usage of the /var/log directory, you would do:
cd /var/log
For example, you can simply type du to see the sizes of all files and directories within the current directory:
This will display a list of files and directories with their respective disk space usage.
If you want to see the sizes in a more human-readable format (e.g., in megabytes or gigabytes), you can use the -h option:
Linux command
For example, to see the top 10 largest items in the current directory:
du -h | sort -rh | head -n 10
Here’s an example of how to use both commands to view network information:
Open your terminal.
To view network information using ifconfig, simply type:
ifconfig
This command will display information about all network interfaces on your system, including their IP addresses, MAC addresses, and more.
The output may look something like this:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::e0:24ff:fe56:78e4 prefixlen 64 scopeid 0x20<link>
ether 00:e0:24:56:78:e4 txqueuelen 1000 (Ethernet)
RX packets 18137 bytes 2675585 (2.5 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11126 bytes 1313992 (1.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
To view network information using ip addr, type:
ip addr
The output may look something like this:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP>
mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
inet 192.168.1.100/24 brd 192.168.1.255 scope global dynamic eth0
valid_lft 85556sec preferred_lft 85556sec
inet6 fe80::e0:24ff:fe56:78e4/64 scope link
valid_lft forever preferred_lft forever
Displays network statistics, routing tables, interface statistics, masquerade connections, and more.
netstat:example
Here’s an example of how to use both netstat and ss:
Open your terminal.
To view network information using netstat, you can run the following command to display a list of network connections:
netstat -tuln
Open your terminal.
To view network information using ss, you can run the following command to display a list of network sockets:
ss -tuln
A replacement for netstat that shows socket statistics.
The ss (Socket Statistics) command is used to display detailed information about network sockets and connections on a Linux system.
Here’s an example of how to use the ss command:
ss:example
Open your terminal.
To view network socket information using ss, you can run the following command to display a list of network sockets:
ss
ss -t
ss -u
To display listening sockets (servers), you can use the -l option:
ss -l
To display numerical addresses and port numbers instead of resolving hostnames, you can use the -n option:
ss -n
Here’s an example of what the ss output might look like:
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
ESTAB 0 0 192.168.1.100:22 192.168.1.10:48512
ESTAB 0 0 192.168.1.100:22 192.168.1.11:39862
Lists hardware information about your system.
The lshw (List Hardware) command is used to list detailed hardware information about your system on a Linux system.
lshw:example
Here’s an example of how to use the lshw command:
Open your terminal.
To view hardware information using lshw, you can run the following command:
sudo lshw
Here’s an example of what the lshw output might look like:
*-memory
description: System Memory
physical id: 2
slot: System board or motherboard
size: 8GiB
*-bank:0
description: DIMM DDR3 Synchronous 1600 MHz (0.6 ns)
product: M471B5173EB0-YK0
vendor: Samsung
physical id: 0
serial: 3A0E54E3
slot: ChannelA-DIMM0
size: 4GiB
width: 64 bits
clock: 1600MHz (0.6ns)
…
*-network
description: Wireless interface
product: Wireless 7260
vendor: Intel Corporation
physical id: 0
bus info: pci@0000:02:00.0
logical name: wlp2s0
…
This will save the hardware information in a text file named hardware_info.txt.
The lscpu command is used to display detailed information about the CPU(s) on a Linux system.
lscpu:example
Here’s an example of how to use the lscpu command:
Open your terminal.
To view CPU information using lscpu, simply type:
lscpu
Here’s an example of what the lscpu output might look like:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 4
On-line CPU(s) list: 0-3
Thread(s) per core: 2
Core(s) per socket:2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 78
Model name: Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
Stepping: 3
CPU MHz: 499.961
CPU max MHz: 3100.0000
CPU min MHz: 400.0000
BogoMIPS: 5184.00
Virtualization: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 4096K
NUMA node0 CPU(s): 0-3
Shows information about block devices (e.g., hard drives and SSDs).
The lsblk command is used to list block devices, such as hard drives, SSDs, and their respective partitions on a Linux system.
lsblk:example
Here’s an example of how to use the lsblk command:
Open your terminal.
To view block device information using lsblk, simply type:
lsblk
This command will display a hierarchical view of block devices, including their sizes, mount points, and more.
Here’s an example of what the lsblk output might look like:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 238.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
├─sda2 8:2 0 2G 0 part /boot
└─sda3 8:3 0 235.9G 0 part
└─root 253:0 0 235.9G 0 lvm /
sdb 8:16 0 1.8T 0 disk
├─sdb1 8:17 0 1.8T 0 part /mnt/data
sdc 8:32 0 250G 0 disk
Here’s an example of how to use the lspci command:
Open your terminal.
To view PCI device information using lspci, simply type:
lspci
Here’s an example of what the lspci output might look like:
00:00.0 Host bridge:
Intel Corporation Xeon E3-1200 v6/7th Gen Core Processor Host Bridge/DRAM Registers (rev 05)
00:01.0 PCI bridge:
Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) (rev 05)
00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 620 (rev 02)
00:04.0 Signal processing controller:
Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem (rev 05)
00:14.0 USB controller:
Intel Corporation Sunrise Point-LP USB 3.0 xHCI Controller (rev 21)
…
Lists USB devices on the system.
The lsusb command is used to list USB devices connected to a Linux system.
Here’s an example of how to use the lsusb command:
Open your terminal.
To view USB device information using lsusb, simply type:
lsusb
This command will list all the USB devices connected to your system, including their vendor and product IDs, device descriptions, and bus information.
Here’s an example of what the lsusb output might look like:
Bus 002 Device 001:
ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006:
ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 004:
ID 04f2:b40e Chicony Electronics Co., Ltd HD WebCam (Acer)
Bus 001 Device 003:
ID 046d:c534 Logitech, Inc. Unifying Receiver
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001:
ID 1d6b:0002 Linux Foundation 2.0 root hub
dmidecode:example
Here’s an example of how to use the dmidecode command:
Open your terminal.
To view detailed hardware information using dmidecode, you can run the following command:
sudo dmidecode
Running dmidecode with sudo is often required to access certain parts of the DMI information.
After running the command, dmidecode will display an extensive list of hardware components and their details.
Here’s an example of what the dmidecode output might look like (the output is quite lengthy):
# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 2.8 present.
126 structures occupying 4426 bytes.
Table at 0x000E5100.
Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
…
Handle 0x0010, DMI type 1, 27 bytes
System Information
…
Handle 0x1000, DMI type 16, 23 bytes
Physical Memory Array
…
Handle 0x1100, DMI type 17, 34 bytes
Memory Device
…
The output provides extensive information about the BIOS, system, memory, CPU, and other hardware components.
You can also use specific keywords to extract information about particular components.
For example, to get information about the BIOS, you can use:
Lists currently loaded kernel modules.
lsmod:example
Here’s an example of how to use the lsmod command:
Open your terminal.
To view the list of currently loaded kernel modules, simply type:
lsmod
This command will list all the kernel modules along with their respective sizes, usage counts, and dependencies.
Here’s an example of what the lsmod output might look like:
Module Size Used by
nvidia 34763776 67
nvidia_drm 40960 6
nvidia_modeset 1196032 12 nvidia_drm
joydev 20480 0
uvcvideo 98304 0
videobuf2_vmalloc 16384 1 uvcvideo
videobuf2_memops 16384 1 videobuf2_vmalloc
btusb 53248 0
btrtl 20480 1 btusb
…
Displays information about running processes.
The ps command is used to view a list of currently running processes on a Linux system. It provides information about processes, such as their Process ID (PID), status, resource utilization, and more. Here’s an example of how to use the ps command:
Open your terminal.
To view a list of currently running processes using the default output format, simply type:
ps
This command will display a list of processes running in your current terminal session.
Here’s an example of what the ps output might look like (the actual output can vary depending on your system and the processes running):
PID TTY TIME CMD
5187 pts/0 00:00:00 bash
5233 pts/0 00:00:00 ps
To view a more detailed list of all processes, including those running in the background and owned by other s, you can use the following command:
This command will provide a comprehensive list of processes along with details such as the who owns the process, CPU and memory utilization, and more.
ps aux
Here’s an example of what the ps aux output might look like (the actual output can be quite extensive):
PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
5187 0.0 0.0 20080 3876 pts/0 Ss Oct28 0:00 bash
5236 0.0 0.0 20428 3864 pts/0 R+ 11:49 0:00 ps aux
The output includes information about the who started the process, the PID, CPU and memory usage, the terminal (TTY) associated with the process, and more.
The ps command is a powerful tool for inspecting and monitoring processes running on your system. You can also use various options and filters with ps to display specific process information or customize the output format as needed.
Shows who is logged into the system.
who:example
The who command is used to display information about s who are currently logged in to a Linux system. Here’s an example of how to use the who command:
Open your terminal.
To view a list of s who are currently logged in, simply type:
who
This command will display a list of names along with their terminal, login time, and originating IP address (if applicable).
Here’s an example of what the who output might look like:
pts/0 2023-10-28 08:30 (192.168.1.100)
guest pts/1 2023-10-28 09:15 (192.168.1.101)
Displays information about currently logged-in s.
The w command is used to display a list of currently logged-in s on a Linux system, along with information about their activities and the terminals they are using.
Here’s an example of how to use the w command:
Open your terminal.
To view a list of logged-in s and their activities, simply type:
w
Here’s an example of what the w output might look like:
09:00:17 up 1 day, 1:30, 2 s, load average: 0.08, 0.03, 0.05
TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
tty1 :0 08:30 1:30m 0.08s 0.01s bash
guest pts/1 192.168.1.101 09:15 0.00s 0.08s 0.02s ssh @hostname
Shows how long the system has been running and the current system load.
Here’s an example of how to use the uptime command:
Open your terminal.
To view the system’s uptime and load averages, simply type:
uptime
This command will display the current time, system uptime, and load averages.
Here’s an example of what the uptime output might look like:
09:00:17 up 1 day, 1:30, 2 s, load average: 0.08, 0.03, 0.05
Displays the current date and time.
date:example
Open your terminal.
To simply view the current system date and time, type:
date
Here’s an example of what the date output might look like:
Thu Oct 28 09:00:17 UTC 2023
For example, to set the system date and time to October 1, 2023, at 15:30:00, you can use the following command (you’ll need super privileges):
sudo date --set "2023-10-01 15:30:00"
Provides detailed CPU information.
Here’s an example of how to do this:
Open your terminal.
To view the CPU information, simply type:
cat /proc/cpuinfo
Here’s an example of what the cat /proc/cpuinfo output might look like (the actual output can vary depending on your system’s hardware):
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 94
model name : Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
stepping : 3
microcode : 0xd6
cpu MHz : 3327.347
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
………..
Here’s an example of using the cat command to display the contents of the /proc/cpuinfo file, which provides detailed information about the CPU(s) on your Linux system:
Open your terminal.
To view the CPU information, simply type:
cat /proc/cpuinfo
This command will display detailed information about the CPU(s) on your system.
Here’s an example of what the cat /proc/cpuinfo output might look like (the actual output can vary depending on your system’s hardware):
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
stepping : 9
microcode : 0x84
cpu MHz : 800.000
cache size : 6144 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : ……
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs
bogomips : 5600.00
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
Shows the Linux kernel version.
The /proc/version file provides information about the kernel version and build details of your Linux system.
You can use the cat command to display the contents of this file.
cat /proc/version:example
Here’s an example:
Open your terminal.
To view the kernel version and build information, simply type:
cat /proc/version
This command will display information about the kernel version, build date, and other relevant details.
Here’s an example of what the /proc/version output might look like (the actual output can vary depending on your system and kernel version):
Linux version 5.4.0-90-generic (buildd@lgw01-amd64-037) (gcc version 9.3.0 (Ubuntu 9.3.0-13ubuntu1)) #101-Ubuntu SMP Tue Nov 30 12:01:41 UTC 2021
The output includes information about the Linux kernel version, compiler version, and various details related to the kernel’s build.
/proc/version is a useful file for checking the kernel version on your system, which can be important for compatibility and troubleshooting.
Explore the /proc directory for various system-related information.
ls /proc:example
The /proc directory in Linux contains a wealth of information about the system, processes, and kernel parameters. To list the contents of the /proc directory, you can use the ls command. However, keep in mind that the directory contains numerous entries, and I’ll provide you with an example that shows a few entries:
Open your terminal.
To list the contents of the /proc directory, simply type:
ls /proc
This command will display a list of files and directories inside the /proc directory.
Here’s an example of what the ls /proc output might look like (a subset of the entries):
1 156 16 189 2580 2588 2590 2598
2606 2613 2632 2637 2643 2734 2759
2760 2763 2767 2769 2771 2776 2778
2783 2785 2786 2787 2788 2789 2790
……
Displays kernel ring buffer messages, which can provide information about hardware and system events.
The dmesg command is used to display kernel ring buffer messages, which can contain information about the kernel, hardware, drivers, and system events. To view the kernel messages, you can use the dmesg command in your terminal.
dmesg:example
Here’s an example:
Open your terminal.
To view the kernel messages, simply type:
dmesg
This command will display the kernel messages, and you can scroll through them to see detailed information about the system, hardware, and kernel events.
Here’s an example of what the dmesg output might look like (a portion of the messages):
[ 0.000000] Linux version 5.4.0-90-generic
….
[ 0.000000] KERNEL supported cpus:
[ 0.000000] Intel GenuineIntel
[ 0.000000] AMD AuthenticAMD
[ 0.000000] Hygon HygonGenuine
[ 0.000000] Centaur CentaurHauls
[ 0.000000] zhaoxin Shanghai
[ 0.000000] Disabled fast string operations
…
The output includes kernel version information, boot parameters, CPU details, and various kernel messages.
dmesg is a valuable tool for diagnosing hardware issues, reviewing system events, and checking for kernel-related problems.
You can search for specific messages within the output to help troubleshoot system problems or monitor kernel activity.
Displays information about system memory.
cat /proc/meminfo
1-Which Linux command is used to display detailed information about the CPU(s) on a Linux system?
a) date
b) lsusb
c) lscpu
d) lsmod
Correct Answer: c) lscpu
2-What command should you use to view information about currently loaded kernel modules on a Linux system?
a) lsmod
b) lsusb
c) dmesg
d) top
Correct Answer: a) lsmod
2-Which command is used to display the system’s current uptime and load averages?
a) who
b) uptime
c) date
d) w
Correct Answer: b) uptime
3-What command displays a list of currently logged-in s on a Linux system along with their activities?
a) ls
b) ps
c) who
d) w
Correct Answer: d) w
4-Which command provides information about the kernel version and build details of a Linux system?
a) uname
b) cat /etc/os-release
c) date
d) cat /proc/version
Correct Answer: d) cat /proc/version
5-Which command is used to retrieve hardware information from the system’s DMI table?
a) lsusb
b) lspci
c) dmidecode
d) cat /proc/cpuinfo
Correct Answer: c) dmidecode
6-What command displays a list of USB devices connected to a Linux system?
a) lscpu
b) lsusb
c) lsmod
d) df
Correct Answer: b) lsusb
7-Which command provides detailed information about currently running processes on a Linux system?
a) who
b) uptime
c) w
d) ps
Correct Answer: d) ps
8-Which command is used to display the Linux distribution and version information?
a) uname
b) cat /etc/os-release
c) lsb_release
d) cat /proc/version
Correct Answer: b) cat /etc/os-release
9-What command displays a list of currently mounted filesystems on a Linux system?
a) lsblk
b) mount
c) df
d) lsusb
Correct Answer: b) mount
10-Which command provides information about the network interfaces and their configuration on a Linux system?
a) ifconfig
b) ip addr
c) netstat
d) lshw
Correct Answer: b) ip addr
11-What command is used to display information about the listening network sockets and routing tables on a Linux system?
a) netstat
b) ifconfig
c) ip addr
d) ss
Correct Answer: a) netstat
12-Which command is used to display information about the memory usage on a Linux system, including total, used, and free memory?
a) lsusb
b) lshw
c) free
d) top
Correct Answer: c) free
13-What command provides information about block devices such as hard drives and partitions on a Linux system?
a) lscpu
b) lsblk
c) df
d) cat /proc/cpuinfo
Correct Answer: b) lsblk
14-Which command is used to display a list of currently loaded kernel modules on a Linux system?
a) lsusb
b) lspci
c) lsmod
d) lscpu
Correct Answer: c) lsmod
15-What command should you use to display the system’s current date and time?
a) dmesg
b) cat /proc/version
c) uptime
d) date
Correct Answer: d) date
16-Which command is used to show a list of USB devices connected to a Linux system?
a) lscpu
b) lsusb
c) lsmod
d) w
Correct Answer: b) lsusb
17-What command is used to display detailed information about the currently running processes on a Linux system?
a) who
b) uptime
c) top
d) ps
Correct Answer: d) ps
18-Which command provides information about the system’s hostname?
a) uname
b) hostname
c) who
d) lsb_release
Correct Answer: b) hostname
19-What command is used to display information about network interfaces, including IP addresses, on a Linux system?
a) ifconfig
b) netstat
c) lshw
d) ip addr
Correct Answer: d) ip addr
20-Which command is used to view detailed information about the currently mounted filesystems on a Linux system, including device names and mount points?
a) mount
b) df
c) lsblk
d) lscpu
Correct Answer: b) df
21-What command provides information about the system’s hardware, including details about the CPU, memory, and peripheral devices?
a) lshw
b) lsblk
c) dmesg
d) w
Correct Answer: a) lshw
22-Which command is used to display a list of available PCI devices and their details on a Linux system?
a) lsusb
b) lsmod
c) lspci
d) cat /proc/cpuinfo
Correct Answer: c) lspci
23-What command is used to show information about currently active and established network connections on a Linux system?
a) ss
b) ip addr
c) netstat
Correct Answer: a) ss
24-Which command is used to display detailed information about the system’s memory usage, including physical and swap memory?
a) free
b) top
c) lsusb
d) lscpu
Correct Answer: a) free