LinuxCommandLibrary

dialog

text-mode dialog boxes for shell scripts

TLDR

Display a message

$ dialog --msgbox "[Message]" [height] [width]
copy
Prompt for text input
$ dialog --inputbox "[Enter text:]" 8 40 2>[output.txt]
copy
Prompt for yes/no question
$ dialog --yesno "[Continue?]" 7 40
copy
Display help
$ dialog
copy

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
Radio button selection
--title title
Set dialog title

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.

SEE ALSO

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

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community