dialog

text-mode dialog boxes for shell scripts

TLDR

Display a message
$ dialog --msgbox "[Message]" [height] [width]
Prompt for text input
$ dialog --inputbox "[Enter text:]" 8 40 2>[output.txt]
Prompt for yes/no question
$ dialog --yesno "[Continue?]" 7 40
Display a menu selection
$ dialog --menu "[Choose one:]" 15 40 4 1 "[Option A]" 2 "[Option B]" 3 "[Option C]" 2>[output.txt]
Display a checklist with multiple selections
$ dialog --checklist "[Select items:]" 15 40 4 1 "[Item A]" on 2 "[Item B]" off 3 "[Item C]" on 2>[output.txt]
Show a progress bar
$ dialog --gauge "[Installing...]" 7 40 0
Display a password input box
$ dialog --passwordbox "[Enter password:]" 8 40 2>[output.txt]

SYNOPSIS

dialog [options] box-type [box-options]

DESCRIPTION

dialog displays dialog boxes from shell scripts, providing a user-friendly text-based interface for interactive scripts. It supports various widget types including message boxes, input boxes, menus, checklists, radio lists, progress bars, and file selection dialogs.The program uses the ncurses library to create pseudo-graphical interfaces in text terminals. This enables shell scripts to present professional-looking user interfaces without requiring a graphical environment.Output is written to stderr (or a specified file), while exit status indicates which button was pressed (0 for OK/Yes, 1 for Cancel/No, 255 for ESC). This design allows scripts to capture both user selections and continue using stdout for other purposes. dialog is widely used in system administration scripts, installation programs, and configuration utilities.

PARAMETERS

--msgbox text height width

Display message with OK button
--yesno text height width
Yes/No question dialog
--inputbox text height width [init]
Text input dialog
--menu text height width menu-height tag item...
Menu selection
--checklist text height width list-height tag item status...
Checkbox selection
--radiolist text height width list-height tag item status...
Radio button selection (single choice)
--gauge text height width percent
Progress bar display
--passwordbox text height width
Password input (hidden characters)
--fselect filepath height width
File selection dialog
--calendar text height width day month year
Calendar date selection
--title title
Set dialog title
--backtitle title
Set background title at top of screen
--clear
Clear screen on exit
--colors
Enable embedded color codes in dialog text
--output-fd fd
Output to specified file descriptor instead of stderr

INSTALL

sudo apt install dialog
sudo dnf install dialog
sudo pacman -S dialog
sudo apk add dialog
sudo zypper install dialog
brew install dialog
nix profile install nixpkgs#dialog

CAVEATS

Output goes to stderr by default; redirect with 2>file. Exit status: 0=OK/Yes, 1=Cancel/No, 255=ESC. For graphical dialogs, see zenity or kdialog.

HISTORY

dialog was originally written by Savio Lam in 1994 and has been maintained by Thomas E. Dickey since 1999. It is based on the ncurses library and has become the standard tool for creating text-mode user interfaces in shell scripts, widely used in Linux distribution installers and configuration tools.

SEE ALSO

whiptail(1), zenity(1), kdialog(1), gum(1)