> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ahmadraza.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting

# Introduction

This guide provides a comprehensive overview of essential network and system commands used for monitoring, troubleshooting, and managing Linux systems. These commands help you gather information about network interfaces, active connections, system resources, and more.

## Network Commands

### Display Network Interface Information for All Interfaces

To display detailed information about all network interfaces:

```bash theme={null}
ifconfig -a
```

### List All Active Network Connections (TCP and UDP)

To view all active network connections, including TCP and UDP:

```bash theme={null}
netstat -a
```

### List Active TCP Connections

To view only active TCP connections:

```bash theme={null}
netstat -at
```

### Display Network Statistics for Ports

To show network statistics related to ports:

```bash theme={null}
netstat -s
```

### Perform DNS Lookup for a Domain Name

To perform a DNS lookup for a specific domain:

```bash theme={null}
nslookup example.com
```

### Perform DNS Query Using the `dig` Command

To query DNS records for a domain:

```bash theme={null}
dig example.com
```

## System Commands

### Display System Uptime

To show how long the system has been running:

```bash theme={null}
uptime
```

### Display Who Is Currently Logged In and What They Are Doing

To view a list of logged-in users and their activities:

```bash theme={null}
w
```

### Display System Resource Usage, Processes, and Their Resource Consumption

To display system resource usage and active processes:

```bash theme={null}
top
```

For an enhanced view with a more user-friendly interface:

```bash theme={null}
htop
```

### Display System Memory Usage

To view current memory usage:

```bash theme={null}
free -h
```

### List Open Files and the Processes That Opened Them

To list all open files and their associated processes:

```bash theme={null}
lsof
```

### List Block Devices (Disk Drives and Partitions)

To list all block devices, such as disks and partitions:

```bash theme={null}
lsblk
```

To view block device information including filesystem types:

```bash theme={null}
blkid
```

### Display System Information, Including the Kernel Version

To show detailed system information and kernel version:

```bash theme={null}
uname -a
```

To display the system hostname:

```bash theme={null}
hostname
```

To display the current user:

```bash theme={null}
whoami
```

To display user and group ID information:

```bash theme={null}
id
```

### Display Information About the Operating System Distribution

To show details about the operating system distribution:

```bash theme={null}
cat /etc/os-release
```

### List All Running Processes

To list all currently running processes:

```bash theme={null}
ps
```

### List All Processes (Including Those Owned by Other Users)

To list all processes, including those owned by other users:

```bash theme={null}
ps -a
```

### List Processes in a Tree-Like Format

To view processes in a hierarchical (parent-child) format:

```bash theme={null}
ps -jT
```

### List Background Jobs

To list jobs running in the background:

```bash theme={null}
jobs
```

### Check for Running Processes Containing "php" in Their Names

To find running processes with "php" in their names:

```bash theme={null}
ps -f | grep php
```

### Display System Hostname and Related Information

To view the system hostname and related settings:

```bash theme={null}
hostnamectl status
```

## Conclusion

These commands are essential for managing and troubleshooting Linux systems. They provide valuable insights into network status, system resource usage, and active processes, helping you effectively monitor and maintain your system.

> This guide covers a range of commands to help you manage and troubleshoot Linux systems, including network-related commands, system resource commands, and process management commands.
