Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reverse and sort files in Linux?

Tags:

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

like image 633
Mint Avatar asked Dec 24 '22 06:12

Mint


2 Answers

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

like image 86
Kornelia Kobiela Avatar answered Jan 02 '23 10:01

Kornelia Kobiela


If you want to work with files and folder names, not to change their names, I hope this will help you:

ls your-path | rev | sort
like image 38
G. Emadi Avatar answered Jan 02 '23 11:01

G. Emadi