开发者

Streaming into a file- linux command explanation needed

开发者 https://www.devze.com 2023-03-29 00:44 出处:网络
My question is simple, I am Linux-illiterate and don\'t know which terminology is appropriate for me to search online, I learn in school and on the Internet that I can perform a Linux\'s ls command as

My question is simple, I am Linux-illiterate and don't know which terminology is appropriate for me to search online, I learn in school and on the Internet that I can perform a Linux's ls command as

开发者_开发技巧

ls > text.txt

to write all of what ls will display into text.txt. And I would like to know how such commands are doing the standard IO ? Thank you


For any command that you run on the command line, you can append a '>', followed by a filename. This instructs the OS (specifically, the shell) to redirect output from the program into the given file. This is what you are doing in the example.

For more information, have a look at e.g.:

  • http://en.wikipedia.org/wiki/Redirection_%28computing%29
  • http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html (specifically the chapter "All about redirection").
0

精彩评论

暂无评论...
验证码 换一张
取 消