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.

4
  • 1
    @user535733 ok so ls / prints out files inside root linux folder and the outputs will be redirected to output.txt . is it right?
    – game lover
    Jan 28 at 18:49
  • Beside the point, but for "roofts", you mean "rootfs", right? But actually, you mean "the root of the filesystem", right? cause rootfs gets mounted over during startup (IIRC)
    – wjandrea
    Jan 28 at 18:49
  • 1
    @wjandrea yes, a typo sorry
    – game lover
    Jan 28 at 18:49
  • 1

1 Answer 1

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."

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.