0

I found

ls / > output.txt

creates output.txt which contains names of folders inside rootfs. But I can't understand what does ls / > exactly mean. I know command ls is used to list all files in the location but what does ls / > do? I did man ls to read definition of ls / > but I couldn't find that there.

1 Answers1

8

/ is the root directory, which contains directories like home and root as well as files like swapfile if you have it set up.

> sends (redirects) the output of a command to a file, in this case, output.txt.

So ls / > output.txt means "list the contents of the root directory and send the output to output.txt."

wjandrea
  • 14,236
  • 4
  • 48
  • 98