diff --git a/tools/nfdc/available-commands.cpp b/tools/nfdc/available-commands.cpp
index 3cd540a..23d55e3 100644
--- a/tools/nfdc/available-commands.cpp
+++ b/tools/nfdc/available-commands.cpp
@@ -25,78 +25,20 @@
 
 #include "available-commands.hpp"
 #include "help.hpp"
-#include "status-report.hpp"
-#include "status-main.hpp"
+#include "status.hpp"
+#include "legacy-status.hpp"
 #include "legacy-nfdc.hpp"
 
 namespace nfd {
 namespace tools {
 namespace nfdc {
 
-static int
-statusReport(ExecuteContext& ctx)
-{
-  ReportFormat fmt = ctx.args.get<ReportFormat>("format", ReportFormat::TEXT);
-  switch (fmt) {
-    case ReportFormat::XML:
-      return statusMain(std::vector<std::string>{"-x"}, ctx.face, ctx.keyChain);
-    case ReportFormat::TEXT:
-      return statusMain(std::vector<std::string>{}, ctx.face, ctx.keyChain);
-  }
-  BOOST_ASSERT(false);
-  return 1;
-}
-
-static int
-statusList(ExecuteContext& ctx, const std::string& option)
-{
-  return statusMain(std::vector<std::string>{option}, ctx.face, ctx.keyChain);
-}
-
-static int
-legacyNfdStatus(ExecuteContext& ctx)
-{
-  auto args = ctx.args.get<std::vector<std::string>>("args");
-  return statusMain(args, ctx.face, ctx.keyChain);
-}
-
 void
 registerCommands(CommandParser& parser)
 {
   registerHelpCommand(parser);
-
-  CommandDefinition defStatusReport("status", "report");
-  defStatusReport
-    .setTitle("print NFD status report")
-    .addArg("format", ArgValueType::REPORT_FORMAT, Required::NO, Positional::YES);
-  parser.addCommand(defStatusReport, &statusReport);
-
-  struct StatusCommandDefinition
-  {
-    std::string noun;
-    std::string verb;
-    std::string legacyOption;
-    std::string title;
-  };
-  const std::vector<StatusCommandDefinition> statusCommands{
-    {"status", "show", "-v", "print general status"},
-    {"face", "list", "-f", "print face list"},
-    {"channel", "list", "-c", "print channel list"},
-    {"strategy", "list", "-s", "print strategy choices"},
-    {"fib", "list", "-b", "print FIB entries"},
-    {"route", "list", "-r", "print RIB routes"}
-  };
-  for (const StatusCommandDefinition& scd : statusCommands) {
-    CommandDefinition def(scd.noun, scd.verb);
-    def.setTitle(scd.title);
-    parser.addCommand(def, bind(&statusList, _1, scd.legacyOption));
-  }
-  parser.addAlias("status", "show", "list");
-
-  CommandDefinition defLegacyNfdStatus("legacy-nfd-status", "");
-  defLegacyNfdStatus
-    .addArg("args", ArgValueType::ANY, Required::NO, Positional::YES);
-  parser.addCommand(defLegacyNfdStatus, &legacyNfdStatus, AVAILABLE_IN_ALL & ~AVAILABLE_IN_HELP);
+  registerStatusCommands(parser);
+  registerLegacyStatusCommand(parser);
 
   struct LegacyNfdcCommandDefinition
   {
diff --git a/tools/nfdc/status-main.cpp b/tools/nfdc/legacy-status.cpp
similarity index 61%
rename from tools/nfdc/status-main.cpp
rename to tools/nfdc/legacy-status.cpp
index c39f694..5eaa581 100644
--- a/tools/nfdc/status-main.cpp
+++ b/tools/nfdc/legacy-status.cpp
@@ -23,34 +23,15 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include "status-main.hpp"
+#include "legacy-status.hpp"
 #include "core/version.hpp"
-#include "status-report.hpp"
-#include "forwarder-general-module.hpp"
-#include "channel-module.hpp"
-#include "face-module.hpp"
-#include "fib-module.hpp"
-#include "rib-module.hpp"
-#include "strategy-choice-module.hpp"
 
-#include <ndn-cxx/security/validator-null.hpp>
 #include <boost/program_options.hpp>
 
 namespace nfd {
 namespace tools {
 namespace nfdc {
 
-struct Options
-{
-  ReportFormat output = ReportFormat::TEXT;
-  bool wantForwarderGeneral = false;
-  bool wantChannels = false;
-  bool wantFaces = false;
-  bool wantFib = false;
-  bool wantRib = false;
-  bool wantStrategyChoice = false;
-};
-
 static void
 showUsage(std::ostream& os, const boost::program_options::options_description& cmdOptions)
 {
@@ -59,17 +40,17 @@
      << cmdOptions;
 }
 
-/** \brief parse command line, and show usage if necessary
+/** \brief parse legacy nfd-status command line, and show usage if necessary
  *  \return if first item is -1, caller should retrieve and display StatusReport;
  *          otherwise, caller should immediately exit with the specified exit code
  */
-static std::tuple<int, Options>
+static std::tuple<int, StatusReportOptions>
 parseCommandLine(const std::vector<std::string>& args)
 {
-  Options options;
+  StatusReportOptions options;
 
   namespace po = boost::program_options;
-  po::options_description cmdOptions("Options");
+  po::options_description cmdOptions("StatusReportOptions");
   cmdOptions.add_options()
     ("help,h", "print this help message")
     ("version,V", "show program version")
@@ -113,69 +94,30 @@
   return std::make_tuple(-1, options);
 }
 
-int
-statusMain(const std::vector<std::string>& args, Face& face, KeyChain& keyChain)
+/** \brief the 'legacy-nfd-status' command
+ */
+static int
+legacyNfdStatus(ExecuteContext& ctx)
 {
+  auto args = ctx.args.get<std::vector<std::string>>("args");
+
   int exitCode = -1;
-  Options options;
+  StatusReportOptions options;
   std::tie(exitCode, options) = parseCommandLine(args);
   if (exitCode >= 0) {
     return exitCode;
   }
 
-  unique_ptr<Validator> validator = make_unique<ndn::ValidatorNull>();
-  CommandOptions ctrlOptions;
+  return reportStatus(ctx, options);
+}
 
-  StatusReport report;
-
-  if (options.wantForwarderGeneral) {
-    auto nfdIdCollector = make_unique<NfdIdCollector>(std::move(validator));
-    auto forwarderGeneralModule = make_unique<ForwarderGeneralModule>();
-    forwarderGeneralModule->setNfdIdCollector(*nfdIdCollector);
-    report.sections.push_back(std::move(forwarderGeneralModule));
-    validator = std::move(nfdIdCollector);
-  }
-
-  if (options.wantChannels) {
-    report.sections.push_back(make_unique<ChannelModule>());
-  }
-
-  if (options.wantFaces) {
-    report.sections.push_back(make_unique<FaceModule>());
-  }
-
-  if (options.wantFib) {
-    report.sections.push_back(make_unique<FibModule>());
-  }
-
-  if (options.wantRib) {
-    report.sections.push_back(make_unique<RibModule>());
-  }
-
-  if (options.wantStrategyChoice) {
-    report.sections.push_back(make_unique<StrategyChoiceModule>());
-  }
-
-  uint32_t code = report.collect(face, keyChain, *validator, ctrlOptions);
-  if (code != 0) {
-    // Give a simple error code for end user.
-    // Technical support personnel:
-    // 1. get the exact command from end user
-    // 2. code div 1000000 is zero-based section index
-    // 3. code mod 1000000 is a Controller.fetch error code
-    std::cerr << "Error while collecting status report (" << code << ").\n";
-    return 1;
-  }
-
-  switch (options.output) {
-    case ReportFormat::XML:
-      report.formatXml(std::cout);
-      break;
-    case ReportFormat::TEXT:
-      report.formatText(std::cout);
-      break;
-  }
-  return 0;
+void
+registerLegacyStatusCommand(CommandParser& parser)
+{
+  CommandDefinition defLegacyNfdStatus("legacy-nfd-status", "");
+  defLegacyNfdStatus
+    .addArg("args", ArgValueType::ANY, Required::NO, Positional::YES);
+  parser.addCommand(defLegacyNfdStatus, &legacyNfdStatus, AVAILABLE_IN_ALL & ~AVAILABLE_IN_HELP);
 }
 
 } // namespace nfdc
diff --git a/tools/nfdc/status-main.hpp b/tools/nfdc/legacy-status.hpp
similarity index 84%
rename from tools/nfdc/status-main.hpp
rename to tools/nfdc/legacy-status.hpp
index 8294a2c..e200292 100644
--- a/tools/nfdc/status-main.hpp
+++ b/tools/nfdc/legacy-status.hpp
@@ -23,20 +23,22 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_TOOLS_NFDC_STATUS_MAIN_HPP
-#define NFD_TOOLS_NFDC_STATUS_MAIN_HPP
+#ifndef NFD_TOOLS_NFDC_LEGACY_STATUS_HPP
+#define NFD_TOOLS_NFDC_LEGACY_STATUS_HPP
 
-#include "execute-command.hpp"
+#include "status.hpp"
 
 namespace nfd {
 namespace tools {
 namespace nfdc {
 
-int
-statusMain(const std::vector<std::string>& args, Face& face, KeyChain& keyChain);
+/** \brief registers 'legacy-nfd-status' command
+ */
+void
+registerLegacyStatusCommand(CommandParser& parser);
 
 } // namespace nfdc
 } // namespace tools
 } // namespace nfd
 
-#endif // NFD_TOOLS_NFDC_STATUS_MAIN_HPP
+#endif // NFD_TOOLS_NFDC_LEGACY_STATUS_HPP
diff --git a/tools/nfdc/status.cpp b/tools/nfdc/status.cpp
new file mode 100644
index 0000000..c14faa3
--- /dev/null
+++ b/tools/nfdc/status.cpp
@@ -0,0 +1,163 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
+/**
+ * Copyright (c) 2014-2016,  Regents of the University of California,
+ *                           Arizona Board of Regents,
+ *                           Colorado State University,
+ *                           University Pierre & Marie Curie, Sorbonne University,
+ *                           Washington University in St. Louis,
+ *                           Beijing Institute of Technology,
+ *                           The University of Memphis.
+ *
+ * This file is part of NFD (Named Data Networking Forwarding Daemon).
+ * See AUTHORS.md for complete list of NFD authors and contributors.
+ *
+ * NFD is free software: you can redistribute it and/or modify it under the terms
+ * of the GNU General Public License as published by the Free Software Foundation,
+ * either version 3 of the License, or (at your option) any later version.
+ *
+ * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE.  See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "status.hpp"
+#include "forwarder-general-module.hpp"
+#include "channel-module.hpp"
+#include "face-module.hpp"
+#include "fib-module.hpp"
+#include "rib-module.hpp"
+#include "strategy-choice-module.hpp"
+
+#include <ndn-cxx/security/validator-null.hpp>
+
+namespace nfd {
+namespace tools {
+namespace nfdc {
+
+int
+reportStatus(ExecuteContext& ctx, const StatusReportOptions& options)
+{
+  unique_ptr<Validator> validator = make_unique<ndn::ValidatorNull>();
+  CommandOptions ctrlOptions;
+
+  StatusReport report;
+
+  if (options.wantForwarderGeneral) {
+    auto nfdIdCollector = make_unique<NfdIdCollector>(std::move(validator));
+    auto forwarderGeneralModule = make_unique<ForwarderGeneralModule>();
+    forwarderGeneralModule->setNfdIdCollector(*nfdIdCollector);
+    report.sections.push_back(std::move(forwarderGeneralModule));
+    validator = std::move(nfdIdCollector);
+  }
+
+  if (options.wantChannels) {
+    report.sections.push_back(make_unique<ChannelModule>());
+  }
+
+  if (options.wantFaces) {
+    report.sections.push_back(make_unique<FaceModule>());
+  }
+
+  if (options.wantFib) {
+    report.sections.push_back(make_unique<FibModule>());
+  }
+
+  if (options.wantRib) {
+    report.sections.push_back(make_unique<RibModule>());
+  }
+
+  if (options.wantStrategyChoice) {
+    report.sections.push_back(make_unique<StrategyChoiceModule>());
+  }
+
+  uint32_t code = report.collect(ctx.face, ctx.keyChain, *validator, ctrlOptions);
+  if (code != 0) {
+    // Give a simple error code for end user.
+    // Technical support personnel:
+    // 1. get the exact command from end user
+    // 2. code div 1000000 is zero-based section index
+    // 3. code mod 1000000 is a Controller.fetch error code
+    std::cerr << "Error while collecting status report (" << code << ").\n";
+    return 1;
+  }
+
+  switch (options.output) {
+    case ReportFormat::XML:
+      report.formatXml(std::cout);
+      break;
+    case ReportFormat::TEXT:
+      report.formatText(std::cout);
+      break;
+  }
+  return 0;
+}
+
+/** \brief single-section status command
+ */
+static int
+reportStatusSingleSection(ExecuteContext& ctx, bool StatusReportOptions::*wantSection)
+{
+  StatusReportOptions options;
+  options.*wantSection = true;
+  return reportStatus(ctx, options);
+}
+
+/** \brief the 'status report' command
+ */
+static int
+reportStatusComprehensive(ExecuteContext& ctx)
+{
+  StatusReportOptions options;
+  options.output = ctx.args.get<ReportFormat>("format", ReportFormat::TEXT);
+  options.wantForwarderGeneral = options.wantChannels = options.wantFaces =
+    options.wantFib = options.wantRib = options.wantStrategyChoice = true;
+  return reportStatus(ctx, options);
+}
+
+void
+registerStatusCommands(CommandParser& parser)
+{
+  CommandDefinition defStatusReport("status", "report");
+  defStatusReport
+    .setTitle("print NFD status report")
+    .addArg("format", ArgValueType::REPORT_FORMAT, Required::NO, Positional::YES);
+  parser.addCommand(defStatusReport, &reportStatusComprehensive);
+
+  CommandDefinition defStatusShow("status", "show");
+  defStatusShow
+    .setTitle("print general status");
+  parser.addCommand(defStatusShow, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantForwarderGeneral));
+  parser.addAlias("status", "show", "list");
+
+  CommandDefinition defFaceList("face", "list");
+  defFaceList
+    .setTitle("print face list");
+  parser.addCommand(defFaceList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantFaces));
+
+  CommandDefinition defChannelList("channel", "list");
+  defChannelList
+    .setTitle("print channel list");
+  parser.addCommand(defChannelList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantChannels));
+
+  CommandDefinition defStrategyList("strategy", "list");
+  defStrategyList
+    .setTitle("print strategy choices");
+  parser.addCommand(defStrategyList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantStrategyChoice));
+
+  CommandDefinition defFibList("fib", "list");
+  defFibList
+    .setTitle("print FIB entries");
+  parser.addCommand(defFibList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantFib));
+
+  CommandDefinition defRouteList("route", "list");
+  defRouteList
+    .setTitle("print RIB entries");
+  parser.addCommand(defRouteList, bind(&reportStatusSingleSection, _1, &StatusReportOptions::wantRib));
+}
+
+} // namespace nfdc
+} // namespace tools
+} // namespace nfd
diff --git a/tools/nfdc/status-main.hpp b/tools/nfdc/status.hpp
similarity index 63%
copy from tools/nfdc/status-main.hpp
copy to tools/nfdc/status.hpp
index 8294a2c..57d0eb8 100644
--- a/tools/nfdc/status-main.hpp
+++ b/tools/nfdc/status.hpp
@@ -23,20 +23,48 @@
  * NFD, e.g., in COPYING.md file.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef NFD_TOOLS_NFDC_STATUS_MAIN_HPP
-#define NFD_TOOLS_NFDC_STATUS_MAIN_HPP
+#ifndef NFD_TOOLS_NFDC_STATUS_HPP
+#define NFD_TOOLS_NFDC_STATUS_HPP
 
-#include "execute-command.hpp"
+#include "status-report.hpp"
+#include "command-parser.hpp"
 
 namespace nfd {
 namespace tools {
 namespace nfdc {
 
+struct StatusReportOptions
+{
+  ReportFormat output = ReportFormat::TEXT;
+  bool wantForwarderGeneral = false;
+  bool wantChannels = false;
+  bool wantFaces = false;
+  bool wantFib = false;
+  bool wantRib = false;
+  bool wantStrategyChoice = false;
+};
+
+/** \brief collect a status report and write to stdout
+ */
 int
-statusMain(const std::vector<std::string>& args, Face& face, KeyChain& keyChain);
+reportStatus(ExecuteContext& ctx, const StatusReportOptions& options);
+
+/** \brief registers status commands
+ *
+ *  Providing the following commands:
+ *  \li status report
+ *  \li status show
+ *  \li face list
+ *  \li channel list
+ *  \li strategy list
+ *  \li fib list
+ *  \li route list
+ */
+void
+registerStatusCommands(CommandParser& parser);
 
 } // namespace nfdc
 } // namespace tools
 } // namespace nfd
 
-#endif // NFD_TOOLS_NFDC_STATUS_MAIN_HPP
+#endif // NFD_TOOLS_NFDC_STATUS_HPP
