LinuxCommandLibrary

disable

Disable printers or classes

SYNOPSIS

disable [-n] NAME [S|0|1|2|3|4|5|6]

PARAMETERS

-n
    Trial run: print actions without making changes

NAME
    Service name (e.g., httpd; must have /etc/init.d/NAME script)

runlevel
    Optional: single runlevel (S,0-6); omits for all

DESCRIPTION

The disable command prevents SysV init services from starting automatically at boot by renaming startup symlinks in runlevel directories. It targets /etc/rcN.d/SnnNAME links, renaming them to DISABLEDnnNAME, where N is the runlevel.

Without a specified runlevel, it affects all (S,0-6). Designed for legacy SysV init systems, it's invoked as root to manage services like httpd or nfs.

The -n option simulates actions without changes. Pair with enable to toggle. In systemd distros, use systemctl disable instead, as disable only impacts SysV links.

Common in RHEL/Fedora pre-systemd setups for quick service control without editing configs.

CAVEATS

Requires root privileges.
Only affects existing SysV symlinks.
No effect on systemd units.
Runlevels must match existing directories.

MECHANISM

Renames SnnNAMEDISABLEDnnNAME in /etc/rcN.d/.

EXAMPLES

disable nfs
Disables NFS in all runlevels.

disable -n httpd 3 5
Previews disabling httpd in runlevels 3,5.

HISTORY

Originated in mid-1990s with initscripts package for Red Hat Linux SysV init service management. Evolved for runlevel symlink handling; largely superseded by systemd since ~2010s.

SEE ALSO

Copied to clipboard