I wish to browse internet via terminal. I want to use w3m with xterm. However, [size=3]when I try to start xterm with white background and black font color
xterm -bg white -fg black
message: [FONT=Verdana]xterm: Xt error: Can’t open display:
[LEFT][LEFT][size=3]xterm: DISPLAY not set[/size][/LEFT]
I have tried several ways, using solutions from the internet, to correct the problem but none of them work. I wonder if anyone can help. Will be very grateful.
“xterm” is an X-windows application. It runs on top of an X graphic session. And $DISPLAY should be already defined within that session.
If you are trying to run “xterm” on a virtual console (CTRL-ALT-Fn), then that is not going to work. But you can probably run “w3m” or “lynx” or “links” or other command line browser directly in that virtual console session (without starting an “xterm”).
I’d recommend you follow @nrickert’s advice to run one of the text-based web browsers he lists, I don’t think you can surf the Internet in a bare terminal console… You need to run an app with some functionality to surf the Internet which doesn’t exist in XTerm. Depending on how the app is written, <maybe> it might run in XTerm, maybe not (YMMV depending on the app you use and its configuration).
As for changing colors in XTerm,
Instead of trying to pass flags on the command line, I’d recommend instead modifying the XTerm configuration file(s).
To identify these configuration files(because the openSUSE files and locations are different than what is described in the XTerm MAN pages), I’d recommend installing the locate utility (package mlocate), updating the database immediately and then simply searching for “XTerm”
The result will be 6 files, 3 which obviously are color configurations, I recommend you open and modify “XTerm-color”
In fact you’ll find a setting you only need to uncomment to reverse your foreground and background colors.
Both w3m and lynx work fine in xterm; so the original issue is an xterm configuration issue.
It is perfectly practical to surf the web using command line browsers as long as the sites do not depend on scripting languages which are not supported by the browser. The main problem is that most websites are not designed for command line use; so typically they have a long list of menu items at the top of every page which you have to scroll through to get to the content of the page.
One use of command line browsers today is to support screen readers; so looking at a website using a command line browser is a good way of finding out the sort of experience which a visually impaired user might have.