Make a Linux “GUI” in the command line

2020-05-23 03:21发布

How to make a Linux program in the Command Line Interface who display a nice user interface?

For example when I use "wget" to download a file from internet, I can see the download advancement in the Command Line Interface. How can I do that?

10条回答
萌系小妹纸
2楼-- · 2020-05-23 03:46

You can just use ANSI escape codes. A simple example in bash

echo -e "\033[H\033[2J  \033[20;20H  \033[4mThis is a underlined line.\033[0m"
查看更多
【Aperson】
3楼-- · 2020-05-23 03:47

You can get a basic interface by using \r to go to the beginning of the current line.

Slightly more advanced is ncurses.

The next step up is Newt.

查看更多
Anthone
4楼-- · 2020-05-23 03:47

If you're using Mono, you could use MonoCurses

查看更多
等我变得足够好
5楼-- · 2020-05-23 03:51

I wouldn't call wget's progress report as a 'nice gui', but anyway, the classic library for building graphical interfaces without X Windows is Linux and UNIX systems is ncurses.

Recently a C# version of ncurses has been started, check out details here

查看更多
登录 后发表回答