• We had to restore from a backup today after a failed software update. Backup was from 0000 EDT and restored it at 0800 EDT so we lost about 8hrs. Today is 07/20/2024. More info here.

Bash Script - ls-octal.sh - ls + octal permissions


Gold Member
Gold Supporter
May 2, 2022
Reaction score
This is my solution from this thread. Member wanted to list all files in a directory with their octal permissions.
This script performs a ls -l style file list, with the octal permissions in the first column. The output formatting isn't perfect, but gets the point across.


# list all files in current directory, and include their octal permissions

# include hidden
shopt -s dotglob

# iterate
for f in *
    echo -n $(stat "$f" -c '%a')" "
    echo "$(ls -ld --color=always "$f")"

If it's ok, I prefer to create a separate thread for my scripts, which will allow conversations to take place without getting lost in the shuffle. I created a post in the new thread, and linked them to get us started.
All good. My goal is a thread without much digression, so maybe that'll keep any digression to the threads you made. That'll help!
Did you mean to post that in this thread:
How about this: I'll put smaller scripts into the main thread, which will help get the thread started. But my larger scripts I'd like to make their own to make conversation easier. Good?
Either way works. The main goal is a central place where people can find 'em. So, that works. The secondary goal is to keep it on topic. That remains to be seen!