What does ls > list and ls >> list do? They don't seem to do anything on my system.
Asked
Active
Viewed 1.4k times
-2
jasonwryan
- 71,734
- 34
- 193
- 226
toa
- 9
- 1
- 1
- 1
-
Checkout: http://www.tldp.org/LDP/abs/html/io-redirection.html basicly > redirects output of command, >> also redirect but append. – alpert Sep 29 '14 at 12:53
-
Start with what finding out what `ls` does. Then apply that before and after running the commands presented. – Anthon Sep 29 '14 at 12:54
2 Answers
1
ls > list
Creates a new file named list and adds the contents of ls command into that file.
You can check the contents of the file list by typing the command as,
cat list
Now, for the second command,
ls >> list
It will append the contents of the ls command to the file named list. So the difference would be if you execute this command 5 times, the output of ls command would be written 5 times to the list file but for the first command each and every time, the output would be overwritten.
Ramesh
- 38,687
- 43
- 140
- 215
0
If you're making
ls > list
and then
ls >> list
you can see the difference by just typing
cat list
after each time.
4m1nh4j1
- 1,823
- 8
- 29
- 40