23

How can I minimize the Terminal window using a command? For example: I use the clear command to clear the terminal output, which command can I have to use to minimize the terminal window?

Braiam
  • 67,791
  • 32
  • 179
  • 269
sunil
  • 233
  • 2
  • 4
  • http://ss64.com/bash/ is a good bash reference, but it does not mention window placement or display. – Simon Jul 09 '13 at 08:11
  • 1
    Atually bg %0 where 0 is the pid of the Terminal Window would send it to the background, not quite the same, but similar :) – Simon Jul 09 '13 at 08:16

2 Answers2

24

You could use this command:

xdotool windowminimize $(xdotool getactivewindow)

You can change xdotool getactivewindow with a specific window that you would like to minimize.

xdotool wouldn't be installed on Ubuntu by default.So run the below command to install xdotool package.

sudo apt-get install xdotool
Avinash Raj
  • 78,556
Mihai
  • 1,644
  • 2
    same command Will not work in Raspberry pi..???? – sunil Jul 09 '13 at 13:54
  • @sunil Do you have xdotool installed on the raspberry pi? – Seth Jul 10 '13 at 01:42
  • You can actually chain the 2 xdotool commands in one (instead of running xdotool twice). Ref: https://ubuntuforums.org/showthread.php?t=2214221 (tried on Ubuntu 16.04) Command: xdotool getactivewindow windowminimize – Champ Oct 09 '18 at 18:04
0

If you are using the byobu terminal, you can press F6 to detach from the current session. This will have the effect of closing the window, but continuing to run byobu and all its subprograms in the background. To reattach to that session, just run byobu again as you normally would.

gabkdlly
  • 1,114