{"id":788,"date":"2024-12-04T08:29:24","date_gmt":"2024-12-04T08:29:24","guid":{"rendered":"https:\/\/www.xopsschool.com\/tutorials\/?p=788"},"modified":"2024-12-04T08:29:24","modified_gmt":"2024-12-04T08:29:24","slug":"linux-commands-to-troubleshoot-performance-issues","status":"publish","type":"post","link":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/","title":{"rendered":"Linux Commands to Troubleshoot Performance Issues"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Check System Load<\/strong> <strong>:<\/strong> Use the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-purple-color\">uptime<\/mark><\/code> command to check system load and uptime:<\/li>\n<\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>uptime<\/code><\/pre>\n\n\n\n<p><strong>2. <\/strong> <strong>Monitor CPU Usage :<\/strong><\/p>\n\n\n\n<p><strong>top : <\/strong>Provides a real-time view of CPU, memory usage, and processes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>top<\/code><\/pre>\n\n\n\n<p><strong>3. Memory Usage and Swapping :<\/strong> <\/p>\n\n\n\n<p><strong>free :<\/strong> Use the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-cyan-color\">free<\/mark><\/code> command to check memory usage<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>free -h<\/code><\/pre>\n\n\n\n<p><strong>4. Disk I\/O Performance : <\/strong><\/p>\n\n\n\n<p><strong><code>iostat<\/code> : <\/strong>Use the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-hexadecimal-color\">iostat<\/mark><\/code> command to monitor disk I\/O performance<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>iostat\n<\/code><\/pre>\n\n\n\n<p><strong>5. Disk Usage : <\/strong><\/p>\n\n\n\n<p><strong>df : <\/strong>Use the <code><strong>df<\/strong><\/code> command to check disk usage<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df -h\n<\/code><\/pre>\n\n\n\n<p><strong>6. Check Logs for Errors : <\/strong><\/p>\n\n\n\n<p><strong>tail : <\/strong>Use the <code>tail<\/code> command to monitor system logs in real-time.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tail -f \/var\/log\/syslog\n<\/code><\/pre>\n\n\n\n<p><strong>7. Check for High CPU Processes : <\/strong><\/p>\n\n\n\n<p><strong>htop : <\/strong>Use the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-orange-color\">htop<\/mark><\/code> command for an interactive process viewer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>htop\n<\/code><\/pre>\n\n\n\n<p><strong>8. Check for High Memory Usage : <\/strong><\/p>\n\n\n\n<p><strong>vmstat : <\/strong>Use the <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-hexadecimal-color\">vmstat<\/mark><\/code> command to report virtual memory statistics<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vmstat\n<\/code><\/pre>\n\n\n\n<p><strong>9. Check Memory Usage : <\/strong><\/p>\n\n\n\n<p><strong>free : <\/strong>The output provides total, used, free memory, and buffers\/cache.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>free -m<\/code><\/pre>\n\n\n\n<p><strong>10. System Information and Monitoring :<\/strong><\/p>\n\n\n\n<p><strong>ps:<\/strong> Display current processes<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ps aux<\/code><\/pre>\n\n\n\n<p><strong>11. Check File Descriptors<\/strong> <strong>:<\/strong><\/p>\n\n\n\n<p><strong>lsof : <\/strong>Lists open files.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>lsof | wc -l\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>lsof -p &lt;PID>\r\n<\/code><\/pre>\n\n\n\n<p><strong>12. Debug System Logs<\/strong> <strong>:<\/strong><\/p>\n\n\n\n<p><strong>dmesg : <\/strong>Prints kernel-related logs.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dmesg | less\r\n<\/code><\/pre>\n\n\n\n<p><strong>13. journalctl :<\/strong> Centralized log viewer.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>journalctl -xe\r\n<\/code><\/pre>\n\n\n\n<p><strong>14. Network Performance<\/strong> <strong>:<\/strong><\/p>\n\n\n\n<p><strong>iftop :<\/strong> Real-time network usage per interface.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install iftop\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo iftop\r\n<\/code><\/pre>\n\n\n\n<p><strong>15. netstat : <\/strong>Displays network connections.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>netstat -tulnp\r\n<\/code><\/pre>\n\n\n\n<p><strong>16. Check CPU Utilization :<\/strong><\/p>\n\n\n\n<p><strong>mpstat :<\/strong> Displays CPU usage for all cores.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo apt install sysstat\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>mpstat -P ALL 1\r\n<\/code><\/pre>\n\n\n\n<p><strong>17. Pidstat : <\/strong>This command monitors tasks managed by the Linux kernel.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pidstat <\/code><\/pre>\n\n\n\n<p><strong>18. Sar : <\/strong>This command is part of the sysstat package and provides performance monitoring.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sar<\/code><\/pre>\n\n\n\n<p><strong>19. Dstat :<\/strong> This command combines vmstat, iostat, and other tools to provide a comprehensive view of system performance.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>dstat<\/code><\/pre>\n\n\n\n<p><strong>20. auditd:<\/strong> System auditing tool<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl start auditd<\/code><\/pre>\n\n\n\n<p><strong>21.<\/strong> <strong>fail2ban:<\/strong> Ban malicious IP addresses<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fail2ban-client status<\/code><\/pre>\n\n\n\n<p><strong>22. iptables:<\/strong> Configure firewall rules<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>iptables -A INPUT -p tcp --dport 22 -j ACCEPT<\/code><\/pre>\n\n\n\n<p><strong>23. ufw:<\/strong> User-friendly firewall<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo ufw allow ssh<\/code><\/pre>\n\n\n\n<p><strong>24. traceroute:<\/strong> Trace the route packets take<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>traceroute google.com<\/code><\/pre>\n\n\n\n<p><strong>25. nslookup:<\/strong> Query DNS nameservers<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nslookup google.com<\/code><\/pre>\n\n\n\n<p><strong>26. ss:<\/strong> Show socket statistics<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ss -tanlp<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>2. Monitor CPU Usage : top : Provides a real-time view of CPU, memory usage, and processes. 3. Memory Usage and Swapping : free : Use the free command to check memory usage 4. Disk I\/O Performance : iostat : Use the iostat command to monitor disk I\/O performance 5. Disk Usage : df : &#8230; <a title=\"Linux Commands to Troubleshoot Performance Issues\" class=\"read-more\" href=\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\" aria-label=\"Read more about Linux Commands to Troubleshoot Performance Issues\">Read more<\/a><\/p>\n","protected":false},"author":200020,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-788","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Linux Commands to Troubleshoot Performance Issues - XOps Tutorials!!!<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Commands to Troubleshoot Performance Issues - XOps Tutorials!!!\" \/>\n<meta property=\"og:description\" content=\"2. Monitor CPU Usage : top : Provides a real-time view of CPU, memory usage, and processes. 3. Memory Usage and Swapping : free : Use the free command to check memory usage 4. Disk I\/O Performance : iostat : Use the iostat command to monitor disk I\/O performance 5. Disk Usage : df : ... Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\" \/>\n<meta property=\"og:site_name\" content=\"XOps Tutorials!!!\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-04T08:29:24+00:00\" \/>\n<meta name=\"author\" content=\"Pritesh Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pritesh Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\"},\"author\":{\"name\":\"Pritesh Kumar\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/121833f332dc4a3674d2904cface44f1\"},\"headline\":\"Linux Commands to Troubleshoot Performance Issues\",\"datePublished\":\"2024-12-04T08:29:24+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\"},\"wordCount\":242,\"commentCount\":0,\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\",\"url\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\",\"name\":\"Linux Commands to Troubleshoot Performance Issues - XOps Tutorials!!!\",\"isPartOf\":{\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/#website\"},\"datePublished\":\"2024-12-04T08:29:24+00:00\",\"author\":{\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/121833f332dc4a3674d2904cface44f1\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.xopsschool.com\/tutorials\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Commands to Troubleshoot Performance Issues\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/#website\",\"url\":\"https:\/\/www.xopsschool.com\/tutorials\/\",\"name\":\"XOps Tutorials!!!\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.xopsschool.com\/tutorials\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/121833f332dc4a3674d2904cface44f1\",\"name\":\"Pritesh Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/231a0e8b7a02636f2fbacf8dcf4494cb1cc0d49ecc9a8165fbaeaeeaf102641a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/231a0e8b7a02636f2fbacf8dcf4494cb1cc0d49ecc9a8165fbaeaeeaf102641a?s=96&d=mm&r=g\",\"caption\":\"Pritesh Kumar\"},\"description\":\"Devops Engineer at Cotocus pvt.ltd\",\"url\":\"https:\/\/www.xopsschool.com\/tutorials\/author\/priteshcotocus\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux Commands to Troubleshoot Performance Issues - XOps Tutorials!!!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/","og_locale":"en_US","og_type":"article","og_title":"Linux Commands to Troubleshoot Performance Issues - XOps Tutorials!!!","og_description":"2. Monitor CPU Usage : top : Provides a real-time view of CPU, memory usage, and processes. 3. Memory Usage and Swapping : free : Use the free command to check memory usage 4. Disk I\/O Performance : iostat : Use the iostat command to monitor disk I\/O performance 5. Disk Usage : df : ... Read more","og_url":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/","og_site_name":"XOps Tutorials!!!","article_published_time":"2024-12-04T08:29:24+00:00","author":"Pritesh Kumar","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Pritesh Kumar","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#article","isPartOf":{"@id":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/"},"author":{"name":"Pritesh Kumar","@id":"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/121833f332dc4a3674d2904cface44f1"},"headline":"Linux Commands to Troubleshoot Performance Issues","datePublished":"2024-12-04T08:29:24+00:00","mainEntityOfPage":{"@id":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/"},"wordCount":242,"commentCount":0,"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/","url":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/","name":"Linux Commands to Troubleshoot Performance Issues - XOps Tutorials!!!","isPartOf":{"@id":"https:\/\/www.xopsschool.com\/tutorials\/#website"},"datePublished":"2024-12-04T08:29:24+00:00","author":{"@id":"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/121833f332dc4a3674d2904cface44f1"},"breadcrumb":{"@id":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.xopsschool.com\/tutorials\/linux-commands-to-troubleshoot-performance-issues\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.xopsschool.com\/tutorials\/"},{"@type":"ListItem","position":2,"name":"Linux Commands to Troubleshoot Performance Issues"}]},{"@type":"WebSite","@id":"https:\/\/www.xopsschool.com\/tutorials\/#website","url":"https:\/\/www.xopsschool.com\/tutorials\/","name":"XOps Tutorials!!!","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.xopsschool.com\/tutorials\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/121833f332dc4a3674d2904cface44f1","name":"Pritesh Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.xopsschool.com\/tutorials\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/231a0e8b7a02636f2fbacf8dcf4494cb1cc0d49ecc9a8165fbaeaeeaf102641a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/231a0e8b7a02636f2fbacf8dcf4494cb1cc0d49ecc9a8165fbaeaeeaf102641a?s=96&d=mm&r=g","caption":"Pritesh Kumar"},"description":"Devops Engineer at Cotocus pvt.ltd","url":"https:\/\/www.xopsschool.com\/tutorials\/author\/priteshcotocus\/"}]}},"_links":{"self":[{"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts\/788","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/users\/200020"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/comments?post=788"}],"version-history":[{"count":2,"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts\/788\/revisions"}],"predecessor-version":[{"id":798,"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/posts\/788\/revisions\/798"}],"wp:attachment":[{"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/media?parent=788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/categories?post=788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xopsschool.com\/tutorials\/wp-json\/wp\/v2\/tags?post=788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}