-3

I am using wget to show html content. In window, it can show the content

enter image description here

In linux, it can not show:

enter image description here

Are there any ways to show all content in Linux

trung
  • 1
  • 4
    Do not post text as images. – Ljm Dullaart Aug 15 '23 at 15:07
  • 1
    Please edit your question to show the command you are using. In the meantime you might check out the `-O` and `--quiet` flags. I am assuming you did read the man page. – doneal24 Aug 15 '23 at 15:14
  • 2
    Note that Powershell's `wget` is an alias for `Invoke-WebRequest`, and not related to the implementation of the linux command of the same name. – user4556274 Aug 15 '23 at 15:37
  • As the wget you have in windows (please try to remember the final 's', before I saw user4556274's comment and guessed that was what you meant, I was thinking that you wanted `wget` to open a window with the downloaded content) has nothing to do with `wget` under linux, you're basically comparing apples and oranges. – Henrik supports the community Aug 15 '23 at 20:35
  • Related - [wget not saving file after download](https://unix.stackexchange.com/a/359977/100397) – roaima Aug 15 '23 at 21:00

3 Answers3

0

wget is typically used to fetch and save files. curl will fetch and display the URL.

$ curl https://unix.stackexchange.com/questions/754090/

<!DOCTYPE html>


    <html class="html__responsive " lang="en">

    <head>

    ...

A. Que
  • 573
  • 1
  • 3
  • 14
  • 1
    For those of us who, if there are two very similar tools stick to just one of them, we can use `wget -O -` to display the content of the page. – doneal24 Aug 15 '23 at 17:16
0

With the && operator, one can chain commands ...

wget https://www.xy.com/report.txt && cat ./report.txt
Martin Zeitler
  • 580
  • 4
  • 13
0

wget doesn't have functionality to display the downloaded things. You need to find a program to display what you download, I luckily have no idea what powershell's wget command/alias does, so I can only say some generic things. You can make wget output the downloaded content on stdout with wget <url> -O -, and that can then be piped to a program to display it. As an example with the url to the first picture in your question:

wget 'https://i.stack.imgur.com/qiMjy.png' -O - | display

(if display is installed, newer distributions might not install it by default) You say that it's html content you downloaded, so you need something to display html. The html file itself is just text, so it can be displayed with e.g. cat or less, but you might want it rendered (and pictures and other referenced stuff also showed), for that you basically need a browser. I don't know whether any of the major graphical browsers support reading from stdin (but as they can also fetch the html, just open the url in them), I know lynx can read from stdin, but as lynx is text-based it won't show pictures and it also doesn't support ECMA-script (sometimes refered to as javascript - at least it didn't last time I bothered with it)