I work in material science so many of my directories are named by chemical element or equation. As such, ls
and ls -v
list my directories out of chemical order. I know I could rename my directories so they start with the atomic number of the element, but I don't want to do that. I was wondering if there was a simple way I could provide customized rules to ls
such that it would list the directories according to the atomic number of the element instead of alphabetic or numeric order. If there was an alternative to ls
that would be acceptable too.
Make some test dirs:
The atomic number for each symbol:
Make a bash function, make sure everything is on one line:
Run it:
Result:
List just the two letter atoms:
There might be better ways...