Search code examples
linuxbashubuntu-18.04

Bash command refuses to run in background with &


I can normally run commands in the background using the command & technique. However, I cannot run commands involving a music player as background commands.

I have tried two music players so far, pogo and then vlc player. For each I am only manually typing in the first command, but the second command is run automatically from the first causing it to take up the foreground again.

$ pogo ~/Downloads/cheering.wav & 
[2] 18841

$ Checking local path /usr/bin/pogo
Checking global path /usr/share/pogo/pogo
Using pogo version at /usr/share/pogo/pogo
DEBUG    stdout logging level: 10
INFO     Writing log to file "/home/mcgoy/.config/pogo/Logs/log"
INFO     System info: machine: x86_64, platform: Linux-4.15.0-65-generic-x86_64-with-Ubuntu-18.04-bionic, processor: x86_64, python_version: 3.6.8, release: 4.15.0-65-generic, system: Linux, GTK: (3, 22, 30), Glib: (2, 56, 1), PyGObject: (3, 26, 1), GST: GStreamer 1.14.5, Mutagen: (1, 38), PIL: 1.1.7
INFO     Started

The bash command is now paused on the task which was supposed to be a background task. It remains in the foreground until I close the player window.

The same thing happens with VLC player

$ cvlc ~/Downloads/cheering.wav &
[4] 17686
VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7)

$ [000056235c753f00] dummy interface: using the dummy interface module...
 #cursor hangs here

Solution

  • It sounds like you want your output to not be present in the shell.

    You can pipe your output to /dev/null if you want to avoid seeing anything, or to any arbitrary file ./my_log_file.txt if you'd rather save the output for later

    pogo ~/Downloads/cheering.wav >/dev/null 2>&1 &