0

I want to run some things differently if I have booted into single-user/maintenance mode.

I want to know how I can test in my .bashrc file. In particular, I would like to start tmux only in that mode.

2 Answers 2

1

Where this info is found possibly varies by distro. Here's a couple of commands that may be helpful:

In Ubuntu Recovery mode (I assume this is single-user), who -r outputs nothing, and runlevel outputs an error runlevel:/var/run/utmp: No such file or directory

In Ubuntu normal boot mode (multi-user), you get the following output:

$ who -r
         run-level 2  2015-06-27 21:41
$ runlevel
N 2
$ 

Here runlevel outputs the previous run level ("N") and the current run level ("2").

0

Note that systemd based systems really don't have runlevels or anything like that, what services are active can be quite more fine grained. At least Fedora retains runlevel(8) and organizes running services into runlevels à la SysV, but that isn't mandatory.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.