bash shell

Overriding cat Command to Display URLs Within Bash

In Bash language command line on Linux PC/server, this article introduces a program to override the cat command so that you can also cat files from URLs.

Shou Arisaka
1 min read
Sep 27, 2025

In Bash language command line on Linux PC/server, this article introduces a program to override the cat command so that you can also cat files from URLs.

It kind of feels like an exaggeration.


cat(){
  : <<<' e.g. cat https://example.com/hoge.md'
  [[ "${1}" =~ ^https?:\/\/ ]] && wget --timeout 5 --tries 5 --quiet -O - "${1}" || /bin/cat "$@"

}

Iโ€™m not doing anything particularly new, but Bash seems to have fewer people knowledgeable about it compared to other languages, so well, for reference.

Image

Share this article

Shou Arisaka Sep 27, 2025

๐Ÿ”— Copy Links