Linux ntsysv Command with Practical Examples

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, we will explore the Linux ntsysv command, a powerful tool for configuring and managing system services. The ntsysv command provides a text-based user interface (TUI) that allows you to easily enable or disable system services. You will learn how to use ntsysv to configure system services and manage runlevels, which are essential skills for system administrators and Linux enthusiasts.

Linux Commands Cheat Sheet


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/SystemInformationandMonitoringGroup(["`System Information and Monitoring`"]) linux/SystemInformationandMonitoringGroup -.-> linux/service("`Service Managing`") subgraph Lab Skills linux/service -.-> lab-422846{{"`Linux ntsysv Command with Practical Examples`"}} end

Understand the ntsysv Command

In this step, we will explore the ntsysv command, a powerful tool for configuring and managing system services in Linux. The ntsysv command provides a text-based user interface (TUI) that allows you to easily enable or disable system services.

First, let's understand the basic usage of the ntsysv command:

sudo ntsysv

This will open the ntsysv interface, where you can navigate through the list of available system services and toggle their status.

Example output:

 Runlevel editor

 [ ] acpid
 [ ] alsa
 [*] apache2
 [ ] avahi-daemon
 [ ] bluetooth
 [ ] brltty
 [ ] console-setup.sh
 [ ] cron
 [ ] cups
 [ ] dbus
 [ ] gdm3
 [ ] getty
 [ ] grub-common
 [ ] irqbalance
 [ ] kmod
 [ ] lvm2-monitor
 [ ] ModemManager
 [ ] NetworkManager
 [ ] nfs-common
 [ ] nmbd
 [ ] nscd
 [ ] open-vm-tools
 [ ] plymouth
 [ ] pppd-dns
 [ ] rsyslog
 [ ] samba
 [ ] saned
 [ ] saslauthd
 [ ] smbd
 [ ] snmpd
 [ ] ssh
 [ ] thermald
 [ ] ufw
 [ ] unattended-upgrades
 [ ] uuidd
 [ ] whoopsie
 [ ] winbind
 [ ] x11-common

 <Tab>,<Space> selects, <Enter> activates buttons, <F12> exits

In the ntsysv interface, you can use the arrow keys to navigate through the list of services, and the spacebar to toggle the service status. The services with a [*] are currently enabled, while the ones with [ ] are disabled.

After making your changes, press F12 to exit and save the changes.

Configure System Services with ntsysv

In this step, we will learn how to use the ntsysv command to configure system services in Linux.

First, let's open the ntsysv interface:

sudo ntsysv

You will see a list of system services that can be enabled or disabled. Use the arrow keys to navigate through the list, and the spacebar to toggle the service status.

For example, let's enable the apache2 service:

 Runlevel editor

 [ ] acpid
 [ ] alsa
 [*] apache2
 [ ] avahi-daemon
 [ ] bluetooth
 [ ] brltty
 [ ] console-setup.sh
 [ ] cron
 [ ] cups
 [ ] dbus
 [ ] gdm3
 [ ] getty
 [ ] grub-common
 [ ] irqbalance
 [ ] kmod
 [ ] lvm2-monitor
 [ ] ModemManager
 [ ] NetworkManager
 [ ] nfs-common
 [ ] nmbd
 [ ] nscd
 [ ] open-vm-tools
 [ ] plymouth
 [ ] pppd-dns
 [ ] rsyslog
 [ ] samba
 [ ] saned
 [ ] saslauthd
 [ ] smbd
 [ ] snmpd
 [ ] ssh
 [ ] thermald
 [ ] ufw
 [ ] unattended-upgrades
 [ ] uuidd
 [ ] whoopsie
 [ ] winbind
 [ ] x11-common

 <Tab>,<Space> selects, <Enter> activates buttons, <F12> exits

After making your changes, press F12 to exit and save the changes.

Manage Runlevels Using ntsysv

In this step, we will learn how to use the ntsysv command to manage system runlevels in Linux.

Runlevels are a way to control the state of the system, determining which services and processes are started or stopped. The ntsysv command allows you to easily configure the services that should be started or stopped for each runlevel.

Let's open the ntsysv interface and navigate to the "Runlevel editor" section:

sudo ntsysv

You will see a list of runlevels, typically 0 through 6, and the services associated with each runlevel.

 Runlevel editor

 [*] Runlevel 0 (Halt)
 [*] Runlevel 1 (Single user mode)
 [*] Runlevel 2 (Multiuser, without NFS)
 [*] Runlevel 3 (Full multiuser mode)
 [*] Runlevel 4 (Unused)
 [*] Runlevel 5 (X11)
 [*] Runlevel 6 (Reboot)

 [ ] acpid
 [ ] alsa
 [*] apache2
 [ ] avahi-daemon
 [ ] bluetooth
 [ ] brltty
 [ ] console-setup.sh
 [ ] cron
 [ ] cups
 [ ] dbus
 [ ] gdm3
 [ ] getty
 [ ] grub-common
 [ ] irqbalance
 [ ] kmod
 [ ] lvm2-monitor
 [ ] ModemManager
 [ ] NetworkManager
 [ ] nfs-common
 [ ] nmbd
 [ ] nscd
 [ ] open-vm-tools
 [ ] plymouth
 [ ] pppd-dns
 [ ] rsyslog
 [ ] samba
 [ ] saned
 [ ] saslauthd
 [ ] smbd
 [ ] snmpd
 [ ] ssh
 [ ] thermald
 [ ] ufw
 [ ] unattended-upgrades
 [ ] uuidd
 [ ] whoopsie
 [ ] winbind
 [ ] x11-common

 <Tab>,<Space> selects, <Enter> activates buttons, <F12> exits

You can navigate through the runlevels and toggle the services associated with each runlevel. For example, you can disable the apache2 service for runlevel 3 by unchecking the corresponding box.

After making your changes, press F12 to exit and save the changes.

Summary

In this lab, we explored the ntsysv command, a powerful tool for configuring and managing system services in Linux. We learned how to use the ntsysv command to navigate through the list of available system services and toggle their status using a text-based user interface. We also discussed how to manage runlevels using ntsysv, which allows us to control the services that start at different system boot levels.

Linux Commands Cheat Sheet

Other Linux Tutorials you may like