Home > Wagento Way > How to Install and Use n98-magerun2 to Manage Magento 2 Websites

How to Install and Use n98-magerun2 to Manage Magento 2 Websites

authorimage

Share:

Grow Your eCommerce

Tell us a little about yourself and we’ll guide you through.


How to Install and Use n98-magerun2 to Manage Magento 2 Websites

Magento 2 default provides a command-line interface to perform some basic operations like installation, modules enable/disable, admin user creation, cache cleaning, etc.

However, as a Magento 2 developer, you have to perform some additional operations during development like dumping database for development, running cron locally, creating dummy customers, etc. There is no such command available in default CLI to perform these jobs.

n98-magerun2 is a command-line tool that provides some handy commands to manage your Magento 2 websites. With the help of commands, you can perform some important operations in Magento 2 without login to your admin panel.

In this tutorial, we will see how to install n98-magerun2 and an overview of some important commands and its use.

How to Install n98-magerun2

  • Step 1: Download the latest version using wget command

wget https://files.magerun.net/n98-magerun2.phar

  • Step 2: Make the phar file executable

chmod +x ./n98-magerun2.phar

  • Step 3: Copy phar file to /usr/local/bin to use the command system wide

sudo cp ./n98-magerun2.phar /usr/local/bin/

  • Step 4: Verify installation

n98-magerun2.phar –version

If it is installed successfully then the above command will show the output like this

n98-magerun2 version 3.2.0 by netz98 GmbH

Basic n98-magerun2 Commands

We will see some basic command which can be useful in day to day Magento 2 development.

System Information

N98-MAGERUN2.PHAR SYS:INFO

This command will display all the important information about your Magento 2 installation like Magento 2 version, edition, Attributes, Products, Categories, Customers, etc.

Create Customer

N98-MAGERUN2.PHAR CUSTOMER:CREATE

Many times while developing, you need to create dummy customers by filling forms either from the frontend or from the admin panel. Using this command, you can quickly create the customer from the terminal.

Run Cron

N98-MAGERUN2.PHAR SYS:CRON:RUN MY_JOB_CODE

Using this command you can easily run a cron job in your local system while developing as well as in server.

DB dump

N98-MAGERUN.PHAR DB:DUMP –COMPRESSION=”GZ” FILENAME

Using this command you can simply dump the Magento database. Sometimes for local development or for staging sites, you do not need all tables. Using this command you can also exclude some tables.

N98-MAGERUN2.PHAR DB:DUMP –STRIP=”@STRIPPED”

The above command will strip logs and sessions from the database. There are many strip options available you can check in this https://github.com/netz98/n98-magerun2#stripped-database-dump link.

Apart from these commands, there are many commands available in n98-magerun2. You can check all available command by running the below command:

N98-MAGERUN2.PHAR LIST

Summary

N98-magerun2 is a really helpful tool for Magento 2 developers. As a Magento 2 developer, you can perform many operations using this tool which is not possible in default Magento 2 CLI.

If you haven’t already tried n98-magerun2, give it a try today.

 

Table of Contents

Grow Your eCommerce

Tell us a little about yourself and we’ll guide you through.

authorimage

About the Author

Chirag boasts over 9 years of IT expertise, specializing in Magento 1 and Magento 2 E-commerce. With 8 years of hands-on experience, he excels in developing and deploying complex Magento projects, including extensions and Web Services. Chirag is adept at client communication, daily work management, and leading small teams. He’s proficient in project management tools like JIRA, Zoho Projects, Trello, and Basecamp. 

Related Topics

Winning with Voice Search on BigCommerce Using Wagento’s Strategies

Imagine you’re preparing a meal in the kitchen, your hands coated in flour, and you suddenly remember you need to order more baking supplies for next week’s project. With Voice Search on BigCommerce, you can place that order without missing a beat. Instead of stopping what you’re doing, washing your hands, and going online, you […]

Decoding Headless Commerce on BigCommerce

Boosts Flexibility for 2025 Retail Success? In today’s fast-paced digital landscape, retailers must continuously innovate to meet the evolving expectations of consumers. One solution is Headless Commerce with platforms like BigCommerce. Traditional monolithic eCommerce platforms often struggle to deliver the flexibility required to adapt swiftly. Enter Headless Commerce BigCommerce—an advanced approach that decouples the front-end […]

Dominate like big brands with Adobe Experience Cloud

As Emily, an eCommerce manager, reviews her Adobe Experience Cloud dashboard, her global team is already in action. While she signs off in London, her colleagues in New York and Sydney are fine-tuning personalized campaigns and analyzing real-time data. The power behind their efforts comes from the integration of Adobe Commerce. By capturing every consumer […]

Talk to a Wagento
Expert Today

Talk to a Wagento
Expert Today

Hey, Don’t Leave Just Yet!

Supercharge Your B2B eCommerce
Let’s simplify, automate, and optimize your operations. Our experts are ready to help you grow!