{"id":14724,"date":"2025-11-06T05:22:32","date_gmt":"2025-11-06T05:22:32","guid":{"rendered":"https:\/\/www.bodhost.com\/kb\/?p=14724"},"modified":"2026-02-26T14:02:06","modified_gmt":"2026-02-26T14:02:06","slug":"what-is-pm2-and-how-can-you-use-it","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/","title":{"rendered":"What is PM2 and How Can You Use It?"},"content":{"rendered":"<p>In this article, you will learn what PM2 is and how it can be used to manage and monitor Node.js applications in a production environment. It covers installation, key features, and essential commands to help you keep your apps running smoothly.<\/p>\n<h2><strong>What is PM2? <\/strong><\/h2>\n<p>PM2 (Process Manager 2) is a production process manager for Node.js applications. It helps developers manage, monitor, and keep applications running continuously without manual intervention. PM2 automatically restarts apps if they crash, supports load balancing across CPU cores, and provides tools for performance monitoring and log management.<\/p>\n<p><strong>Features<\/strong><\/p>\n<ul>\n<li>Automatic Restarts: Automatically restarts applications after a crash or error.<\/li>\n<li>Cluster Mode: Distributes workload across multiple CPU cores for better performance.<\/li>\n<li>Monitoring: Tracks CPU and memory usage in real time.<\/li>\n<li>Logging: Provides combined and error log management.<\/li>\n<li>Startup Scripts: Enables apps to start automatically when the system reboots.<\/li>\n<li>Zero-Downtime Reloads: Allows updates or restarts without service interruption.<\/li>\n<li>Configuration Files: Supports JSON\/YAML configuration files for multiple applications.<\/li>\n<\/ul>\n<p><strong>Installation<\/strong><\/p>\n<ol>\n<li>Install PM2 globally using npm:\n<pre><span style=\"color: #3366ff;\">npm install -g pm2<\/span><\/pre>\n<\/li>\n<li>Check the installation using the following command:\n<pre><span style=\"color: #3366ff;\">pm2 --version<\/span><\/pre>\n<\/li>\n<\/ol>\n<p><strong>Basic Commands<\/strong><\/p>\n<ol>\n<li>pm2 start app.js \u2013 Starts an application.<\/li>\n<li>pm2 list \u2013 Lists all running applications.<\/li>\n<li>pm2 stop &lt;app_name&gt; \u2013 Stops a running application.<\/li>\n<li>pm2 restart &lt;app_name&gt; \u2013 Restarts the specified app.<\/li>\n<li>pm2 delete &lt;app_name&gt; \u2013 Removes an application from PM2\u2019s process list.<\/li>\n<li>pm2 logs &lt;app_name&gt; \u2013 Displays logs for a specific application.<\/li>\n<li>pm2 monit \u2013 Opens the PM2 monitoring dashboard.<\/li>\n<\/ol>\n<p><span style=\"text-decoration: underline;\"><strong>Using Cluster Mode<\/strong><\/span><\/p>\n<p>Cluster mode allows PM2 to run multiple instances of an application across CPU cores.<\/p>\n<p>Example:<\/p>\n<pre><span style=\"color: #3366ff;\">pm2 start app.js -i max<\/span><\/pre>\n<p>The -i max flag automatically launches one instance per available CPU core.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Auto-Start on Boot<\/strong><\/span><\/p>\n<p>To make PM2-managed applications start automatically after a reboot, use:<\/p>\n<pre><span style=\"color: #3366ff;\">pm2 startup\r\npm2 save<\/span><\/pre>\n<p>pm2 startup generates a startup script, and pm2 save saves the current list of running applications.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Monitoring and Logs<\/strong><\/span><\/p>\n<p>You can view and monitor applications directly from the command line:<\/p>\n<pre><span style=\"color: #3366ff;\">pm2 logs\r\npm2 monit<\/span><\/pre>\n<p>For advanced monitoring, PM2 can be connected to PM2 Plus, which provides a web-based dashboard.<\/p>\n<p>This way, we can conclude that PM2 is a powerful and easy-to-use process manager for <a href=\"https:\/\/www.bodhost.com\/kb\/how-to-debug-node-js-applications\/\" target=\"_blank\" rel=\"noopener\">Node.js applications<\/a>. It helps ensure uptime, simplifies scaling with cluster mode, and provides useful monitoring tools for production environments.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, you will learn what PM2 is and how it can be used to manage and monitor Node.js applications in a production environment. It covers installation, key features,&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":21,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[837],"tags":[1659],"class_list":["post-14724","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-what-is-pm2"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>What is PM2 and How Can You Use it?<\/title>\n<meta name=\"description\" content=\"Learn what PM2 is and how to use it to manage Node.js applications efficiently to start, monitor, restart, and optimize your apps easily.\" \/>\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.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"What is PM2 and How Can You Use it?\" \/>\n<meta property=\"og:description\" content=\"Learn what PM2 is and how to use it to manage Node.js applications efficiently to start, monitor, restart, and optimize your apps easily.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2025-11-06T05:22:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:02:06+00:00\" \/>\n<meta name=\"author\" content=\"Serena\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Serena\" \/>\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.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/\"},\"author\":{\"name\":\"Serena\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\"},\"headline\":\"What is PM2 and How Can You Use It?\",\"datePublished\":\"2025-11-06T05:22:32+00:00\",\"dateModified\":\"2026-02-26T14:02:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/\"},\"wordCount\":374,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"What is PM2?\"],\"articleSection\":[\"Tutorial\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/\",\"name\":\"What is PM2 and How Can You Use it?\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2025-11-06T05:22:32+00:00\",\"dateModified\":\"2026-02-26T14:02:06+00:00\",\"description\":\"Learn what PM2 is and how to use it to manage Node.js applications efficiently to start, monitor, restart, and optimize your apps easily.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/what-is-pm2-and-how-can-you-use-it\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Tutorial\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/tutorial\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"What is PM2 and How Can You Use It?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/ffd3f118493c99471ae5bd4790a55830\",\"name\":\"Serena\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g\",\"caption\":\"Serena\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/seema\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"What is PM2 and How Can You Use it?","description":"Learn what PM2 is and how to use it to manage Node.js applications efficiently to start, monitor, restart, and optimize your apps easily.","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.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/","og_locale":"en_US","og_type":"article","og_title":"What is PM2 and How Can You Use it?","og_description":"Learn what PM2 is and how to use it to manage Node.js applications efficiently to start, monitor, restart, and optimize your apps easily.","og_url":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2025-11-06T05:22:32+00:00","article_modified_time":"2026-02-26T14:02:06+00:00","author":"Serena","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Serena","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/"},"author":{"name":"Serena","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830"},"headline":"What is PM2 and How Can You Use It?","datePublished":"2025-11-06T05:22:32+00:00","dateModified":"2026-02-26T14:02:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/"},"wordCount":374,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["What is PM2?"],"articleSection":["Tutorial"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/","url":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/","name":"What is PM2 and How Can You Use it?","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2025-11-06T05:22:32+00:00","dateModified":"2026-02-26T14:02:06+00:00","description":"Learn what PM2 is and how to use it to manage Node.js applications efficiently to start, monitor, restart, and optimize your apps easily.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/what-is-pm2-and-how-can-you-use-it\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Tutorial","item":"https:\/\/www.bodhost.com\/kb\/category\/tutorial\/"},{"@type":"ListItem","position":2,"name":"What is PM2 and How Can You Use It?"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/ffd3f118493c99471ae5bd4790a55830","name":"Serena","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8bf3c9f6220a13a4d46295ad7c38a0c9e351ca3a57d0e417580c8e8b83a12a50?s=96&d=mm&r=g","caption":"Serena"},"url":"https:\/\/www.bodhost.com\/kb\/author\/seema\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/14724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/21"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=14724"}],"version-history":[{"count":4,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/14724\/revisions"}],"predecessor-version":[{"id":14729,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/14724\/revisions\/14729"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=14724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=14724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=14724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}