grasshopper
grasshopper

Reputation: 1401

Generate file that contains a list of all files in a directory on linux

I know how to do this on windows, but I want to create a list of files that are in a directory on a linux machine, either as a txt or csv file. Or is there a way to save the output of a command rather than showing it on screen? Any help is appreciated.

Upvotes: 0

Views: 11089

Answers (1)

Lev Levitsky
Lev Levitsky

Reputation: 65811

ls lists the files in a folder, check man ls for options. To save the output of a shell command use redirection, e.g.:

ls > list.txt

or

ls -l > list.txt

etc.

Upvotes: 7

Related Questions