How to use the command 'elinks' (with examples)
Elinks is a versatile text-based web browser that enables users to interact with web content directly from the command line. This tool is particularly useful for users who need a lightweight solution, offering speedy navigation without relying on graphical displays. Elinks is beneficial for those working in environments where graphical web browsers might be too resource-intensive or impractical, such as on servers or older hardware. Additionally, it can be an ideal choice for users who prefer or need keyboard-centric operation over point-and-click interfaces.
Use case 1: Starting Elinks
Code:
elinks
Motivation:
Starting Elinks in a terminal is the first step to accessing web content. By utilizing this command, users can start browsing various websites directly from their command-line interface without graphical interruptions. This can be particularly beneficial for quickly accessing textual information, server environments, or low-bandwidth situations where graphical browsers may struggle or be overly cumbersome.
Explanation:
elinks
: This command initiates the Elinks browser, allowing the user to begin interacting with web pages through a text-based interface. Running this command opens the browser and provides a starting point for users to navigate to their desired web pages.
Example output:
Upon execution, the terminal changes, showing a minimalistic web interface, prompting the user to input a URL or browse saved bookmarks.
Elinks
[1] Enter URL:
Use case 2: Quitting Elinks
Code:
<Ctrl> + C
Motivation:
Knowing how to quit Elinks efficiently is crucial for users to return to their regular command-line activities. Quitting the application ensures that resources are freed and the terminal is returned to its default interaction state. This is particularly important for those who use Elinks frequently and need to switch between the browser and other command-line tasks seamlessly.
Explanation:
<Ctrl> + C
: This keyboard shortcut interrupts the current process running in the terminal, effectively closing the Elinks browser. The combination is a standard interrupt command which is useful for stopping any command-line application.
Example output:
After pressing <Ctrl> + C
, the application quits, and the user is returned to the terminal command-line prompt.
$ _
Use case 3: Dumping Webpage Output to Console with Colorization
Code:
elinks -dump -dump-color-mode 1 url
Motivation:
This use case allows users to display webpage content directly in the terminal while preserving ANSI color codes for better readability. It is advantageous for scripting or debugging when the visual structure of a webpage needs to be examined or documented in a textual format. The colorization can help identify different types of content on the web page more effortlessly, such as links, headers, and text.
Explanation:
elinks
: Calls the Elinks application.-dump
: This option tells Elinks to output the webpage content directly to the console as plain text rather than in an interactive browsing mode.-dump-color-mode 1
: Thedump-color-mode
option with the value set to1
enables ANSI color output, adding color codes to emphasize different elements of the text, similar to syntax highlighting.url
: Replace this with the actual URL of the webpage you want to output. It’s a placeholder for the web address whose content will be dumped to the console.
Example output:
When executed with a valid URL, the terminal displays the webpage’s text content, with ANSI color sequences embedded to differentiate various sections visually.
Example Heading:
This is some text content from the webpage.
Example Link:
Click here to follow the link.
Conclusion:
Elinks is a robust tool for those who value efficiency, simplicity, and speed in their web browsing tasks, especially within terminal environments. By effectively using its commands, users can navigate, quit, and even export web content in a text-based manner, meeting various needs from casual browsing to complex text scraping and processing tasks.