For a standard "box around a message", use boxes
:
echo 'This is a test' | boxes
boxes
will look like this (First one. Second one is a custom like cowsay
):

If you mean an alert box, use notify-send
:
notify-send 'title' 'message'
notify-send
looks like this:

You also can use zenity
for a popup window:
zenity --error --text="An error occurred\!" --title="Warning\!"
Zenity is more graphical and has more options, like having the window appear as a question, using:
zenity --question --text="Do you wish to continue/?"
or even progress bars, using:
find /usr | zenity --progress --pulsate --auto-close --auto-kill --text="Working..."
zenity
looks like this:

Or use dialog
, for a command-line only message box:
dialog --checklist "Choose OS:" 15 40 5 \
1 Linux off \
2 Solaris on \
3 'HP UX' off \
4 AIX off
dialog
looks like this:

Another option is whiptail
:
whiptail --title "Example Dialog" --msgbox "This is an example of a message box. You must hit OK to continue." 8 78
whiptail
looks like this:

And if you are truly crazy, use toilet
:
toilet -F border -F gay "CRAZY"
toilet
looks like this:

xmessage
is even installed on Ubuntu Server by default. So I can usessh -Y <host>
to log into the machine while forwarding x connections and then runsome-command; xmessage "some-command is done"
to pop up a notification on my desktop when the long running command is finished. – Stephen Ostermiller May 03 '19 at 20:30xmessage -timeout 10 "Goodbye in 10s!"
. – AlainD Sep 11 '19 at 15:49xmessage -button OK:0,Cancel:101 Hello; echo $?
returns 0 (success) if user presses OK and 101 if he presses cancel. – Quasímodo Nov 11 '21 at 18:45xmessage -fn '-*-*-*-r-*-*-26-*-*-*-*-*-*-*' 'My message'
, use xfontsel for a good tool to find a good font. – Real Nov 29 '21 at 14:13Xmessage*font: -*-*-*-r-*-*-26-*-*-*-*-*-*-*
to the file. – Real Nov 29 '21 at 14:51||||
lines at the beginning of the line? – alper Jan 21 '23 at 14:53