s---shell Verified current stable Not installed? System Operations

S Shell / Launch Shell As Superuser Without Changing Environment

Launch Shell As Superuser Without Changing Environment

Open a shell under superuser without altering the current environment settings.

$
Terminal
sudo -s

When To Use

When executing commands that require root access without losing the current session's environment context.

Pro Tip

Use `export` command to re-apply any necessary environment variables after switching.

Anatomy of Output

Understanding the result

user@hostname:~$ sudo -s Command Initiation

Starts a new shell as root.

root@hostname:~# Root User Shell Prompt

Indicates successful switch to root user shell.

# Current Environment Variables Environment Context

Maintains current user's environment variables despite escalation.

Troubleshooting

Common pitfalls

sudo: unable to execute shell: Permission denied

Solution: Check shell permissions in `/etc/shells` for validity.

sudo: command not found

Solution: Ensure `sudo` is installed and available in the PATH.

bash: cannot set terminal process group

Solution: Reconnect to a non-misconfigured terminal.

Command Breakdown

What each part is doing

sudo
Base Command
The executable that performs this operation. Here it runs S Shell before the shell applies any redirect operators.
-s
s| shell
The value supplied for s| shell.
-s
Command Option
Tool-specific option used by this command invocation.

Alternative Approaches

Comparable commands in other tools

Alternative system operations tools for the same job.