ntsysv Command in Linux



The ntsysv is a straightforward interface designed to manage and configure runlevel services in Unix/Linux systems. This utility is a part of the chkconfig package, and its primary role is to facilitate the enabling and disabling of services at various runlevels, enhancing system administration efficiency.

Table of Contents

Here is a comprehensive guide to the options available with the ntsysv command −

Overview of ntsysv Command

By default, ntsysv configures the services for the current runlevel. This means that when you run the command without specifying any additional options, it will display and allow you to manage the services that are active in your current runlevel.

  • If you need to configure services for runlevels other than the current one, ntsysv provides the flexibility to do so. You can specify the desired runlevels directly on the command line using the --level option followed by the runlevel numbers without any spaces. For instance, using the option --level 016 would allow you to edit services for runlevels 0, 1, and 6.
  • A service is considered to be active in the set of runlevels being edited if it is started in any of those specified runlevels. This holistic approach ensures that administrators can manage services effectively across multiple runlevels from a single interface.
  • The ntsysv window typically includes a Cancel button, which allows users to exit without making any changes. However, if the --back option is specified, a Back button will appear instead, providing a more intuitive way to navigate back to the previous menu or screen.

On Debian-based systems, using ntsysv is somewhat limited because they have switched to systemd as the default system and service manager. It means these systems no longer use the old runlevel system and instead rely on systemd targets to manage services. As a result, while you might be able to install ntsysv, it doesn't work well with the modern service management setup used by these distributions. On the other hand, for Red Hat-based systems like RHEL, CentOS, and Fedora, ntsysv is still useful. These systems still support the old SysVinit system and chkconfig tools, even though they also use systemd now.

ntsysv continues to work for managing legacy services in systems that use the older init systems, particularly on RHEL/CentOS versions that have not fully migrated to systemd. While newer releases use systemd by default, ntsysv remains functional for those who prefer the traditional runlevel management style, particularly when used with chkconfig.

Syntax of ntsysv Command

The general syntax for the ntsysv command is as follows −

ntsysv [OPTIONS]

ntsysv Command Options

The following options provide flexibility and control over how you manage and configure system services using ntsysv

Tag Description
--back Replaces the Cancel button with a Back button in the ntsysv window.
--level <levels> Configures specific runlevels. For example, --level 016 to configure runlevels 0, 1, and 6.

Examples of ntsysv Command in Linux

The following examples can help you get started with the ntsysv command and manage your system services effectively −

Configuring Services for the Current Runlevel

To manage and configure services for the current runlevel, you can use the following command −

sudo ntsysv

This command opens the ntsysv interface, allowing you to enable or disable services for the runlevel your system is currently operating in. Use the arrow keys to navigate and the spacebar to toggle services on or off.

Configuring Services for Specific Runlevels

To configure services for specific runlevels, you can run the following command −

sudo ntsysv --level 35

In this example, the command configures services for runlevels 3 and 5. The --level 35 option specifies that you want to manage services for both of these runlevels. This is useful for ensuring that certain services are enabled or disabled only in specific runlevels.

Using the Back Button Instead of Cancel

To replace the Cancel button with a Back button in the ntsysv interface, simply use the following command −

sudo ntsysv --back

This command opens the ntsysv interface with a Back button, providing a more intuitive navigation option.

Configuring Multiple Runlevels with Back Button

To configure multiple runlevels while also using the Back button, you can run the following command −

sudo ntsysv --level 016 --back

This command configures services for runlevels 0, 1, and 6 and replaces the Cancel button with a Back button.

Conclusion

The ntsysv command is a handy tool for managing and configuring system services across different runlevels in Unix/Linux systems. It provides an easy-to-use text interface that lets system administrators enable or disable services for the current runlevel or specific ones, simplifying the management of system services across different states.

Advertisements