I use xinit to start X with wm - startx command that using .xinitrc to invoke X11 environment, but when X starts, there a black screen with cursor staying there for few seconds before X is fully started and if I press ctrl-c to interrupt the process, it will drop to shell, meaning user always has a way to go into shell - how to disable this ability?

  • Did you try wm - startx & to run it as a background task? – Zhro Mar 5 '19 at 3:51
  • @Zhro: I just use .profile to startx, what's difference with your command? I'll try and give feedback. – Tuyen Pham Mar 5 '19 at 7:47

The issue here is that you're calling startx in the foreground. If you want it to run in the background and not be susceptible to ctrl-c then append & at the end of the command.

For example:

sleep 3s && echo 1

This command will sleep for three seconds and then echo 1 to standard output. As it is in the foreground, you can interrupt it with ctrl-c.

Alternatively, you can continue to work on other things in the foreground while it runs in the background until either you log out or it terminates:

sleep 3s && echo 1 &

See here for more examples:


If you are just running startx then try replacing it with startx &.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.