What do these commands mean and do? "ls > l" and "ls >> l". I have tried them, but it seems as if they do the same thing - create a file named "l".
Asked
Active
Viewed 70 times
3 Answers
2
ls > l
It create the file and write the output of ls into it.
ls >> l
But this command append the data to existing file if it exist else it does same as above mentioned .

Arnab Nandy
- 6,472
- 5
- 44
- 50
2
ls > l
It redirects to file. It creates the file and overwrites whatever is written in it.
ls >> l
It redirects and append stdout to file.

tumisma
- 375
- 3
- 14
1
This commands list a directory.
The first creates a new file every time it runs and write the output to the file. the second appends the output of ls to the existing file.

Jens
- 67,715
- 15
- 98
- 113