[英]How to reverse and sort files in Linux?
I'm trying to take files in a directory and reverse them and then sort them alphabetically. 我正在尝试将文件放在目录中并将其反转,然后按字母顺序对它们进行排序。 So that Cat Dog So the output Would be God Tac
那么Cat Dog所以输出将是God Tac
如果您想使用文件和文件夹名称,而不是更改其名称,我希望这将有助于您:
ls your-path | rev | sort
If you use terminal write: 如果你使用终端写:
ls -r
It show you your files and directories in reversed order. 它以相反的顺序显示您的文件和目录。 I don't know what kind of Graphical Interface you use.
我不知道你使用什么样的图形界面。 In Gnome you must show files as a list and sort by name (clicking it) diminishing
在Gnome中,您必须将文件显示为列表,并按名称(单击它)逐渐减少
This will do the trick in plain shell script: 这将在普通shell脚本中完成:
(list the files of a directory, reverse their names and sort them alphabetically) (列出目录的文件,反转它们的名称并按字母顺序排序)
ls | rev | sort
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.