心血来潮,想在Linux终端下浏览网页…对w3m印象比较深,下面介绍下它的用法
补充一点,想在控制台下看图片,需要安装zhcon
Options
Command line usage is
w3m [options] [file|URL]
If you specify filenames/URLs on command line, these documents are displayed. If you specify nothing, w3m reads a document from standard input and display it. If no filename and/or URLs are specified and standard input is tty, w3m terminates without displaying anything.
Options are as follows:
- +<line number>
- Move to the specified line.
- -t width
- Specify tab width. Default is 8.
- -r
- When displaying text/plain document, prohibit emphasis using backspace. If you don’t specify this option, “A^H_” is interpreted as underlined character and “A^HA” as a bold character.
- -l number
- Specify line number preserved internally when reading text/plain document fron standard input. Default is 10000.
- -s
- Display documents with Shift_JIS code.
- -e
- Display documents with EUC_JP code.
- -j
- Display documents with ISO-2022-JP code.
- -T type
- Specify document type. Without this option, document type is determined from extension of a file. If the determination fails, the document is regarded as text/plain.
Example:
Read HTML document from standard input and display itcat hoge.html | w3m -T text/html
Display HTML source
w3m -T text/plain hoge.html
- -m
- Display document with Internet message mode. With this option, w3m determines document type from header information. It is useful when reading E-mail or NetNews messages.
- -v
- visual startup mode.
- -B
- Show the bookmark.
- -bookmark file
- Specify bookmark file.
- -M
- Monochrome display mode.
- -F
- Automatically render frame.
- -S
- Squeeze blank lines.
- -X
- Upon exit, do not display preserved screen.
- -W
- Toggle wrap search mode.
- -o option=value
- Specify option. The option names and values are same as that appears in ~/.w3m/config.
- -cookie
- Process cookies.
- -no-cookie
- Don’t process cookies.
- -pauth username:password
- Set username and password for (basic) proxy authentication.
- -num
- Show linenumber.
- -dump
- Read document specified by URL and dump formatted text into standard output. The width of the document become 80. This width can be overridden with -cols option.
- -cols width
- Specify document width. Used with -dump option.
- -ppc count
- Specify the number of pixels per character (default 8.0). Larger values will make tables narrower.
- -dump_source
- Read document specified by URL and dump the source.
- -dump_head
- Read document specified by URL and dump headers.
- -dump_both
- Read document specified by URL and dump headers and the source.
- -dump_extra
- Read document specified by URL and dump extra informations, headers and the source.
- -post file
- use POST method with file content.
- -header string
- insert string as a header.
- -no-proxy
- Don’t use proxy server.
- -no-graph
- Don’t use graphic character to draw frames.
- -no-mouse
- Don’t activate mouse.
- -config file
- specify config file.
Document color
Links and images are displayed as follows.
| Color mode | Monochrome mode | |
|---|---|---|
| links | blue | underline |
| inline images | green | reverse |
| form input | red | reverse |
These colors can be customized using option setting command "o".
Key binding
After invocation, you can operate w3m by one-character commands from the keyboard.
Here’s the original key-binding table. If you are using Lynx-like key bindings, see the Lynx-like key binding.
Page/Cursor motion
| SPC,C-v | Forward page |
| b,ESC v | Backward page |
| l,C-f | Cursor right |
| h,C-b | Cursor left |
| j,C-n | Cursor down |
| k,C-p | Cursor up |
| J | Roll up one line |
| K | Roll down one line |
| ^,C-a | Go to the beginning of line |
| $,C-e | Go to the end of line |
| w | Go to next word |
| W | Go to previous word |
| > | Shift screen right |
| < | Shift screen left |
| . | Shift screen one column right |
| , | Shift screen one column left |
| g,M-< | Go to the first line |
| G,M-> | Go to the last line |
| ESC g | Go to specified line |
| Z | Move to the center line |
| z | Move to the center column |
| TAB | Move to next hyperlink |
| C-u,ESC TAB | Move to previous hyperlink |
| [ | Move to the first hyperlink |
| ] | Move to the last hyperlink |
Hyperlink operation
| RET | Follow hyperlink |
| a, ESC RET | Save link to file |
| u | Peek link URL |
| i | Peek image URL |
| I | View inline image |
| ESC I | Save inline image to file |
| : | Mark URL-like strings as anchors |
| ESC : | Mark Message-ID-like strings as news anchors |
| c | Peek current URL |
| = | Display information about current document |
| C-g | Show current line number |
| C-h | View history of URL |
| F | Render frame |
| M | Browse current document using external browser (use 2M and 3M to invoke second and third browser) |
| ESC M | Browse link using external browser (use 2ESC M and 3ESC M to invoke second and third browser) |
File/Stream operation
| U | Open URL |
| V | View new file |
| @ | Execute shell command and load |
| # | Execute shell command and browse |
Buffer operation
| B | Back to the previous buffer |
| v | View HTML source |
| s | Select buffer |
| E | Edit buffer source |
| C-l | Redraw screen |
| R | Reload buffer |
| S | Save buffer |
| ESC s | Save source |
| ESC e | Edit buffer image |
Buffer selection mode
| k, C-p | Select previous buffer |
| j, C-n | Select next buffer |
| D | Delect current buffer |
| RET | Go to the selected buffer |
Bookmark operation
| ESC b | Load bookmark |
| ESC a | Add current to bookmark |
Search
| /,C-s | Search forward |
| ?,C-r | Search backward |
| n | Search next |
| N | Search previous |
| C-w | Toggle wrap search mode |
Mark operation
| C-SPC | Set/unset mark |
| ESC p | Go to previous mark |
| ESC n | Go to next mark |
| " | Mark by regular expression |
Miscellany
| ! | Execute shell command |
| H | Help (load this file) |
| o | Set option |
| C-k | Show cookie jar |
| C-c | Stop |
| C-z | Suspend |
| q | Quit (with confirmation, if you like) |
| Q | Quit without confirmation |
Line-edit mode
| C-f | Move cursor forward |
| C-b | Move cursor backward |
| C-h | Delete previous character |
| C-d | Delete current character |
| C-k | Kill everything after cursor |
| C-u | Kill everything before cursor |
| C-a | Move to the top of line |
| C-e | Move to the bottom of line |
| C-p | Fetch the previous string from the history list |
| C-n | Fetch the next string from the history list |
| TAB,SPC | Complete filename |
| RETURN | Accept |

