How to use file protocol to access a directory on local system?

前端 未结 5 1444
無奈伤痛
無奈伤痛 2021-02-15 23:39

like /usr/local?

I tried file:///usr/local but failed

[root@www2 robot]# cd file:///usr/local
-bash: cd: file:///usr/local: No          


        
5条回答
  •  庸人自扰
    2021-02-16 00:25

    If you have a requirement to be able to access generic URLs from your shell, try using curl as a replacement for your cat:

    curl file:///path/to/file.txt
    curl http://www.domain.com/file.txt
    

    But as other posters have pointed out, the shell itself doesn't understand URLs.

提交回复
热议问题