Score:0

what does ls / > mean?

cl flag

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.

game lover avatar
cl flag
@user535733 ok so ls / prints out files inside root linux folder and the outputs will be redirected to output.txt . is it right?
wjandrea avatar
cn flag
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)
game lover avatar
cl flag
@wjandrea yes, a typo sorry
wjandrea avatar
cn flag
Related: [What's is the difference between ">" and ">>" in shell command?](/q/382793/301745)
Score:8
cn flag

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

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.