How to use the command 'elinks' (with examples)
The ’elinks’ command is a text-based browser similar to ’lynx’. It allows users to browse websites and access web content from the command line. In this article, we will illustrate several use cases of the ’elinks’ command.
Use case 1: Start ELinks
Code:
elinks
Motivation: The motivation for using this example is to start the ELinks browser and access web content from the command line. This is useful when you want to quickly browse websites without opening a graphical web browser.
Explanation:
elinks
: This is the command used to start the ELinks browser.
Example output: When the ’elinks’ command is executed, the ELinks browser will start, and the user will be presented with the browser interface.
Use case 2: Quit ELinks
Code:
Ctrl + C
Motivation: The motivation for using this example is to quit the ELinks browser. This is useful when you are finished browsing and want to exit the browser.
Explanation:
Ctrl + C
: This keyboard combination is used to send a SIGINT signal to the running process, which in this case is ELinks. This will terminate the ELinks browser.
Example output: When the ‘Ctrl + C’ combination is pressed, the ELinks browser will exit, and the user will return to the command line.
Use case 3: Dump output of webpage to console, colorizing the text with ANSI control codes
Code:
elinks -dump -dump-color-mode 1 url
Motivation: The motivation for using this example is to retrieve the textual content of a webpage and display it on the console. The text is colorized using ANSI control codes, which helps visually distinguish different elements of the webpage.
Explanation:
elinks
: This is the command used to start the ELinks browser.-dump
: This option tells ELinks to dump the content of the webpage instead of displaying it in the browser interface.-dump-color-mode 1
: This option specifies the color mode to use when dumping the content. In this case, ANSI control codes are used to colorize the text.url
: This is the URL of the webpage to be dumped.
Example output: When the command is executed, ELinks will retrieve the content of the specified webpage and display it on the console. The text will be colorized using ANSI control codes, making it easier to read and understand.
Conclusion:
In this article, we have illustrated several use cases of the ’elinks’ command. We have seen how to start and quit the ELinks browser, as well as how to dump the content of a webpage to the console with colorized text. These examples showcase the versatility of the ELinks browser and its ability to access web content from the command line.