您的位置:首页 > 运维架构 > Linux

Linux 终端浏览器 w3m

2017-06-26 16:07 204 查看
三款比较有名的 w3m、links2、lynx、其中 w3m 对中文的支持很好,没出现乱码,而那两款都会有乱码

w3m 安装

sudo apt-get install w3m

图片插件安装

sudo apt-get install w3m w3m-img

如果出现乱码,可以用w3m打开任意网页,键盘键入o,然后将显示语言调整为chinese

如果你的locale不是gbk的话还是会乱码的。所以运行 export LC_ALL=zh_CN.GBK

w3m支持鼠标拖拽功能,w3m的基本键

a 在文本框里输入文字

g 页面顶端

G 页面底部

s 切换历史(buffer)

S 保存网页至文件

v 网页/源码切换

h j k l 左下上右,和vim同

w 以word右进

Tab 在各连接之间切换

H 显示帮助

q 退出,会有提示的

j,k,l,h 移动光标,就像vim中一样

J/K 向下/向上滚屏

</> 左右滚屏

T 打开一个新标签页

Esc-t 打开所有标签页,供你选择,使用jk来上下移动

{/} 在标签页中切换 当然也可以用鼠标点击切换

U 输入新的网址

B 后退

Ctrl+q 关闭当前标签页

/ 向后查找当前页

? 向前查找当前页

w3m -help可以显示帮助信息,一些w3m的基本命令

下面是w3m -help 回显的内容:

usage: w3m [options]

options:

-t tab set tab width

-r ignore backspace effect

-l line # of preserved line (default 10000)

-I charset document charset

-O charset display/output charset

-B load bookmark

-bookmark file specify bookmark file

-T type specify content-type

-m internet message mode

-v visual startup mode

-M monochrome display

-N open URL of command line on each new tab

-F automatically render frame

-cols width specify column width (used with -dump)

-ppc count specify the number of pixels per character (4.0...32.0)

-ppl count specify the number of pixels per line (4.0...64.0)

-dump dump formatted page into stdout

-dump_head dump response of HEAD request into stdout

-dump_source dump page source into stdout

-dump_both dump HEAD and source into stdout

-dump_extra dump HEAD, source, and extra information into stdout

-post file use POST method with file content

-header string insert string as a header

+<num> goto <num> line

-num show line number

-no-proxy don't use proxy

-4 IPv4 only (-o dns_order=4)

-6 IPv6 only (-o dns_order=6)

-no-mouse don't use mouse

-cookie use cookie (-no-cookie: don't use cookie)

-pauth user:pass proxy authentication

-graph use graphic character

-no-graph don't use graphic character

-s squeeze multiple blank lines

-W toggle wrap search mode

-X don't use termcap init/deinit

-title[=TERM] set buffer name to terminal title string

-o opt=value assign value to config option

-show-option print all config options

-config file specify config file

-help print this usage message

-version print w3m version

-reqlog write request logfile

-debug DO NOT USE

w3m 设置用户名密码自动登录

w3m 有一个功能是自动登录需要用户名和密码的网站
方法:
追加 ~/.w3m/passwd 文件:
host host-name
port port-number
realm Username for *****:  ***** 的那一部分
login user
password password


注意一点,realm的值是后面星号的部分。比如
提示 "Username for trac:",那 realm 对应的值是 trac
最后将 passwd的访问权限改成600

参考文章:http://blog.csdn.net/amds123/article/details/70146366
http://blog.csdn.net/robertsong2004/article/details/41577021
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: