如何发送文件的列表中选择一个文件夹中的在Linux一个txt文件 [英] How to send list of file in a folder to a txt file in Linux

查看:102
本文介绍了如何发送文件的列表中选择一个文件夹中的在Linux一个txt文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是相当新的Linux(在这种情况下,CentOS的)。我有在它约2000文件的文件夹。我想在那个会写出来的所有文件的名称到一个单一的TXT文件中的命令提示符下理想的执行命令。

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 out the name of all the files into a single txt file.

如果我有,我可以写一个实际的程序来做到这一点,我只是想有可能是一个办法简单地做到这一点,从命令提示符。

If I have to, I could write an actual program to do it too, I was just thinking there might be a way to simply do it from the command prompt.

推荐答案

您可以只用

ls > filenames.txt

(通常,通过使用终端,或壳或击启动外壳。)您可能需要使用 CD 进入该文件夹第一,或者您也可以 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

这篇关于如何发送文件的列表中选择一个文件夹中的在Linux一个txt文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆