This article is part of a longer series covering the n98-magerun power tool
N98-magerun commands are organized in a tree hierarchy. For example, the
command is actually the
list command, under the top level category
extension. These categories don’t tie back to any particular Magento system. Instead, they exist to help end users (you) find the commands, as well as discover other commands they may not have known about.
Today we’re going to look at the “top level” commands. These are commands that don’t exist in any category. Here’s the command descriptions from the built-in help.
help Displays help for a command install Install magento list Lists commands mysql-client Opens mysql client by database config from local.xml open-browser Open current project in browser (experimental) self-update Updates n98-magerun.phar to the latest version. selfupdate Updates n98-magerun.phar to the latest version. shell Runs n98-magerun as shell uninstall Uninstall magento (drops database and empties current folder
help command grants you access to built-in documentation for each
$ n98-magerun.phar help [command name]
This help will give you a (very) brief description of the command, as well as list any extra arguments the command accepts. This should be your first stop if you have any questions about a particular command
Similar to the
help command, the
list command will list out all possible
$ n98-magerun.phar list
This list is similar (or identical) to the default output of
n98-magerun running with no paramaters. It’s worth breezing through this list to see what sort of things
n98-magerun can do.
selfupdate commands can be used to update your
n98-magerun phar archive itself.
$ n98-magerun.phar selfupdate
This update process will use the
versions.txt in the
netz98 github account to determine if you’re up to date, and if not the latest
n98-magerun.phar will be downloaded automatically, replacing your existing version.
shell command allows you to run
n98-magerun as a CPAN like shell
$ n98-magerun.phar shell n98-magerun > help Usage: help [--xml] [command_name] Arguments: command The command to execute command_name The command name (default: "help") etc ...
This can be useful if you wish to run several commands in sequence, or are exploring the commands offered by the system.
mysql-client command will open a command line mysql browser and automatically connect to the Magento system you’re currently browsing (remember,
n98-magerun requires you to run “
cd-ed” into a Magento directory). If you work with multiple Magento system you’ll see how this helps prevent the “I was using the wrong database” problem.
open-browser command lets you automatically open a web browser window to the current Magento system. In addition to grabbing the base URL from the configuration, this command lets you automatically change to a specific store view by providing its ID or code as an argument
$ n98-magerun.phar open-browser 1 $ n98-magerun.phar open-browser default
or selecting from an interactive menu
$ n98-magerun.phar open-browser  default - English  french - French  german - German Please select a store:
install command provides a command line interface for installing Magento. While
install contains many command line flags for scripting installations (use the
help command to see them all), where it really shines is the interactive shell program that will walk you through an entire installation
$ n98-magerun.phar install Magento Installation  magento-ce-220.127.116.11  magento-ce-18.104.22.168  mageplus-master  magento-mirror-22.214.171.124  magento-mirror-126.96.36.199  magento-mirror-188.8.131.52  magento-ce-184.108.40.206-dev (experimental) Choose a magento version:
install command with no arguments will kick off a shell program that downloads a version of Magento to your computer, and collects the information needed to perform a command line install using the
install.php script that ships with Magento. This command will perform all the needed Magento tasks for an installation — you’ll still need to install a version of MySQL, and expose Magento to a web server (Apache, Nginx, etc.) yourself.
uninstall command can be used to remove a Magento installation from your machine. Personally, with hard drive space being cheap and access to a site only a simple
sudo apachectl graceful away, I’m not a fan of a destructive command like
uninstall. However, if you’re less conservative than I am,
uninstall is there if you need it.