LinuxCommandLibrary

rc

Execute initialization scripts at boot/runlevels

TLDR

Start listening on a specific port

$ rc -lp [port]
copy

Start a reverse shell
$ rc [host] [port] -r [shell]
copy

SYNOPSIS

rc [RUNLEVEL]

PARAMETERS

0
    Changes the system runlevel to 0, typically initiating a system halt or shutdown.

1 or S or s
    Changes the system runlevel to 1 (single-user mode), providing a minimal environment for system maintenance.

2, 3, 4, 5
    Changes the system runlevel to a multi-user mode. The specific services started or stopped in these runlevels depend on the system's configuration (e.g., /etc/inittab and /etc/rcX.d scripts).

6
    Changes the system runlevel to 6, typically initiating a system reboot.

DESCRIPTION

The rc command, commonly found as an applet within BusyBox, functions as a simplified System V init compatible runlevel change utility. It is primarily used in embedded systems or minimal Linux environments where a full-featured init system like systemd or traditional SysVinit might be too resource-intensive. When invoked, rc typically triggers a change to a specified system runlevel, causing the execution of corresponding initialization or shutdown scripts, often found in directories like /etc/init.d or /etc/rcX.d. Its behavior is often a subset of what a full init process would provide, focusing specifically on managing the system's operational state by transitioning between runlevels.

CAVEATS

The rc command is specific to BusyBox and is not a standard standalone utility found in all GNU/Linux distributions. Its presence and exact behavior depend on how BusyBox was compiled and installed. In many BusyBox setups, rc might be a symbolic link to the init applet, inheriting its functionalities. It offers limited features compared to full-fledged init systems like systemd or traditional SysVinit.

CONFIGURATION FILES

The behavior of rc relies on system configuration files such as /etc/inittab (which defines runlevels and processes) and scripts located in directories like /etc/init.d/ and /etc/rcX.d/ (which contain scripts executed during runlevel transitions).

USAGE CONTEXT

Predominantly found in environments utilizing BusyBox, such as embedded Linux devices (e.g., routers, IoT devices), minimal server installations, or custom-built Linux distributions where resource efficiency is paramount.

HISTORY

BusyBox itself was created by Bruce Perens in 1996 to provide a compact set of Unix utilities for embedded systems. The rc applet (often part of or linked to the init applet) was included from early versions to offer essential system startup and runlevel management capabilities in environments with limited resources, adhering to a simplified System V init style. Its development has focused on efficiency and minimal footprint.

SEE ALSO

init(8), telinit(8), runlevel(8), systemd(1)

Copied to clipboard