How to send list of file in a folder to a txt file in Linux

后端 未结 2 1808
梦如初夏
梦如初夏 2020-12-13 12:30

I\'m fairly new to Linux (CentOS in this case). I have a folder with about 2000 files in it. I\'d like to ideally execute a command at the command prompt that would write

2条回答
  •  囚心锁ツ
    2020-12-13 13:14

    you can just use

    ls > filenames.txt
    

    (usually, start a shell by using "Terminal", or "shell", or "Bash".) You may need to use cd to go to that folder first, or you can ls ~/docs > filenames.txt

提交回复
热议问题