Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Linux Commands to Troubleshoot Performance Issues

In this tutorial we’re going to learn how to Troubleshoot Performance Issues with the CPU, RAM, disc I/O, network usage, and general responsiveness of the system. You can use the following popular Linux commands and utilities to troubleshoot performance issues:

1 nmap Command:

Network exploration tool and security scanner.

nmap -p 1-1000 wizbrand.com

Output:-

2. sar (System Activity Reporter):

In Unix-like operating systems, the command-line utility sar, or System Activity Reporter, gathers, reports, and saves system activity data. It is used to track system performance data and is a component of the sysstat package. Real-time data on CPU load, memory paging, swap utilisation, network I/O, and other topics are available from Sar. Additionally, it can show historical data for particular time periods, enabling examination of previous performance problems.

After installation, sar allows you to view historical data from log files or real-time statistics. For instance, you only need to run sar into the terminal to see the CPU load for the current day. The command sar interval iterations, where interval is the number of seconds between snapshots and iterations is the number of times to produce the statistics, can be used to display real-time statistics.

The following are some typical sar command options:

  • -A: All statistics
  • -b: I/O statistics
  • -B: Swap usage statistics
  • -d: I/O for each block device
  • -n ALL: All network statistics
  • -q: Processor queue (cache) statistics
  • -r: Memory and swap statistics
  • -u: CPU statistics (default)
  • -v: Kernel statistics
  • -W: Simplified swap statistics

3. iostat

Linux users can obtain CPU and input/output statistics for devices and partitions using the iostat command-line utility. Its purpose is to track the loading of system input/output devices by measuring the duration of each device’s operation in comparison to its typical transfer rate.

Here are some common uses of iostat with examples:

  • Basic usage: Running iostat without any arguments will display CPU and device statistics since the last reboot.
  • Detailed statistics: Using the -x option will show more detailed statistics information.
iostat -x
  • CPU statistics only: To display only CPU statistics, use the -c option.
iostat -c
  • Device statistics only: The -d option will display only the device report.
iostat -d
  • Extended I/O statistics for devices: The -xd option shows extended I/O statistics for devices only.
iostat -xd
  • Statistics in kilobytes or megabytes: The -k option captures the statistics in kilobytes, and -m captures them in megabytes.
iostat -k
iostat -m
  • Repetition and delay: You can set a count (the number of times to update) and a delay (the interval between updates). For instance, running iostat -k 2 3 will produce 3 reports and show CPU and device data with a 2-second lag between each report.
iostat -k  2  3
  • Persistent device name statistics: The -j option allows you to display persistent device name statistics.
iostat -j ID mmcbkl0 sda6 -x -m  2  2
  • Statistics for block devices: The -p option displays statistics for block devices.
iostat -p
  • LVM2 statistic information: The -N option displays LVM2 statistic information.
iostat -N

4. ifconfig Command

Displays or configures network interfaces.

Example :-

ifconfig

5. ip Command

Provides extensive networking information.

Example :-

ip addr show

6. arp Command

Displays the ARP cache.

Example :-

arp -a

Output:-

7. route Command

Displays and manipulates the IP routing table.

Example :-

route -n

Output :-

8. dig Command

Performs DNS lookup and displays the response.

Example :-

dig wizbrand.com

Output:-

9. host Command

Performs DNS lookup and displays the response.

Example :-

host wizbrand.com

Output:-

10. uptime Command:

Displays system uptime and load average.

Example :-

uptime

11. free Command

Displays free and used memory in the system.

free -m

Output:-

12 df Command

Displays disk space usage.

Example :-

df -h

13 du Command

Displays disk usage of files and directories.

Example :-

du -sh htdocs

Output:-

14. ps Command

Displays a snapshot of current processes.

Example:-

ps aux

Output:-

15. top Command

Displays real-time information about system processes and resource usage.

Example:-

top

Output:-

16 htop Command:

Interactive process viewer.

Example :-

htop

Output:-

17. lsof Command

Lists open files and the processes that opened them.

lsof

Output:-

18. strace Command

Traces system calls and signals.

strace -p PID

19. dmesg Command

Displays kernel ring buffer messages

dmesg

Output:-

20. journalctl Command

Views system logs (systemd).
Example:-

journalctl -xe

Output:-

21. lsmod Command

Lists loaded kernel modules

Example:-

lsmod

Output:-

22. tcpdump Command

Captures and displays network packets.

Example:-

tcpdump -i eth0

Output:-

23. iftop Command

Displays bandwidth usage on an interface.

Example:-

iftop -i eth0

Output:-

Thanks for reading.👍👍

Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.

Related Posts

Here’s a list of 50 Linux commands commonly used for troubleshooting a Linux server:

1. ping Command Tests connectivity to a remote host. 2. netstat Command Displays network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. Output: – 3….

Top 50 Linux Commands for Administrator

In this tutiorial i’m going to share Top 50 Linux command for administrator use. ls is probably the first command every Linux user types in their terminal….

How to connect redis in laravel project ?

In this tutorial we’re going to learn how to connect redis database in laravel project. I have mentioned in step by step ini very easy way. What…

Problem 1 – laravel/passport[v11.5.0, …, v11.8.4] require league/oauth2-server ^8.2

In this tutorial we’re going to solve then error Problem 1 – laravel/passport[v11.5.0, …, v11.8.4] require league/oauth2-server ^8.2 Error :- Solutions : – Now issue has been…

Traceback (most recent call last):File “/usr/bin/pipenv”, line 33, insys.exit(load_entry_point(‘pipenv==11.9.0’, ‘console_scripts’, ‘pipenv’)())

In this tutorial i’m going to solve the issue “Traceback (most recent call last):File “/usr/bin/pipenv”, line 33, insys.exit(load_entry_point(‘pipenv==11.9.0’, ‘console_scripts’, ‘pipenv’)())” Error :- Solutions :-

Top 25 Linux Commands for Users ?

In this tutorial i’m going to share Top 50 Important Linux Command for users with example. 1. Use of ls -la command. The ls -la command is…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x