I found this question: How can I run a command which will survive terminal close?, which addresses exactly what I want to do. And I've been using it for a few applications.

But my problem is that I want to use terminal to run a program (OBS) with sudo (root?), because I want it to write to a mounted disk to record. So it requires write permissions that it doesn't natively have (maybe that's the issue?). And, I want to run it from a terminal, and have the terminal shut down as soon as I start the program.

I'm familiar with Linux, but I'm still super derpy at it. I know I have the drive mounted upon boot via fstab. But I if I don't run OBS with elevated rights, it gives me errors for recording.

Can I do this from the terminal and have the terminal shut down afterwards, but keep OBS open, or is this more involved?

(Using Manjaro.)

  • While I'm not versed enough to give you the exact answer, I can tell that what you want to look at really is the permissions, as you already suspected. Running something like OBS with root is always a (bad) workaround. There are ways to mount a drive so that a user can write to it. Check out some related questions. Also, have you thought about using something like dmenu (or similar application starter)?
    – domsson
    Dec 8, 2019 at 5:10
  • If I remember correctly, you should be able to fix the permission issues by (a) mounting the drive somewhere in your regular user's home dir (/home/asinine/mount, for example), (b) using the rw, user and uid/gid options in the fstab mount command (possibly also umask=000 if this is an ntfs drive).
    – domsson
    Dec 8, 2019 at 5:21
  • I am confused: Do you want to close terminal after (as in title, and paragraph 2), or to have the command continue after terminal closes (paragraph 1)? Please edit question to make this clear. Dec 8, 2019 at 7:16
  • You don't need to be root to write to a device: That is what file permissions are for. Change the file permissions (ownership / mode / etc). You will need elevated capabilities to do this (e.g. sudo to root). Dec 8, 2019 at 7:18
  • Indeed, running a program as root for a sole purpose of write permissions is bad. With linux file systems you can modify permissions, ownership or - if the filesystem supports them - ACLs. For other file systems you can set permissions during mount or assign them to the mount directory. You may run the command as a user with permissions limited to running the program and to its working directory. Running as root should be the very last on the list. Also, it's not very clear if you want to have the window closed as soon as the program is run in the background, or as soon as it terminates.
    – Jasio
    Dec 8, 2019 at 10:04

2 Answers 2


This should do it.

command & disown; exit

The & puts it in the background. The disown tells the shell to not job control it. The exit tells the shell to exit.

You can put it in an alias, to make it easier to use. e.g. (for a different program)

alias mon="ksysguard& disown; exit"

Put the alias in ~/.bashrc

However I think this is an XY problem: you are trying to solve the wrong problem.

  • After your (plural) comments and this explanation (and the XY reference), I believe this is the correct way to solve the problem I thought I had. But as it was pointed out, it was a permissions problem. I think I figured that out, as obs now runs and records (because I allowed it access to the separate hard drive), and I can use my plain original obs & exit without necessitating sudo.
    – Asinine
    Dec 10, 2019 at 22:21

Another approach can be use the nohup command, that is delegated to run a command in backround and write the result to a file.

  • I had actually been looking into nohup, but all I seemed to accomplish with it was having a log file, for reasons I don't understand. I did get it working (with sudo, while trying to figure this out before posting here), but I don't understand why I'd want the log file attached to the process. I'd think might as well just have another window open, since at least that isn't writing logs I don't need?
    – Asinine
    Dec 10, 2019 at 22:25
  • You can append & to the command in order to run the process in background, and you can redirect the output to /dev/null in order to discard the log Dec 11, 2019 at 9:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .