Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there in the linux any program which can represent (via pipe or something like that) results of such commands as, for example, ls, cat, grep, ps etc, by means of curses (for example as listbox)? So by means of such program I would like to select (by means of arrows keys or hjkl) some particular item from the list instead of copy-pasting it?

I need something like dialog. It allows to create custom windows with custom widgets but I need from all these widgets only listbox, and I would like to have possibility to customize it. For example I would like to be able (within config-file or parameters) to change its behavior when press enter (for example, such list may contain list of media files which I can play by pressing on enter). Also I would like to be able to change appearance of such listbox so it may contains different columns, also I would like searchable listbox and colorized.

share|improve this question
Haven't seen such ready-made solutions on Linux; dialog is still your best bet, it seems. – Deer Hunter Apr 1 '13 at 18:46

I agree with the comment that dialog is probably where you need to start. To show you how you could use it, here is an example script


#make some temporary files

#make sure the temporary files are removed even in case of interruption
trap "rm $command_output;
      rm $menu_output;
      rm $menu_config;" SIGHUP SIGINT SIGTERM

#replace ls with what you want
ls >$command_output

#build a dialog configuration file
cat $command_output |
  awk '{print NR " \"" $0 "\""}' |
  tr "\n" " " >$menu_config

#launch the dialog, get the output in the menu_output file
dialog --no-cancel --title "Put you title here" \
       --menu "Choose the correct entry" 0 0 0 \
       --file $menu_config 2>$menu_output

#revcover the output value

#recover the associated line in the output of the command
entry=$(cat $command_output | sed -n "${menu_item}p" $config_file)

#replace echo with whatever you want to process the chosen entry
echo $entry

#clean the temporary files
[ -f $command_output ] && rm $command_output
[ -f $menu_output ] && rm $menu_output
[ -f $menu_config ] && rm $menu_config

In addition, from your question, it seems that you may also prefer a console file manager. There exists many of them, like ranger or midnight commander. If these are not configurable enough for your needs, their source code could probably prove useful in the design of your own tool.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.