Link to home
Start Free TrialLog in
Avatar of Ryan_R
Ryan_RFlag for Australia

asked on

BASH (Linux) - View file permission

Making a simple script

I know how to change file permissions - but how do I view them (what command)?

Thanks
Avatar of hongjun
hongjun
Flag of Singapore image

ls -l filename

This will show the permissions
Avatar of Ryan_R

ASKER

Hi hongjun

I'm using that command already to view file statistics (I think).

Assuming I haven't got my wires crossed, does that command show both file statistics and permissions?
Thanks
Avatar of Ryan_R

ASKER

Just checked:

I did have the code for the permissions - it turns out that I needed to view File Statistics

Sorry to mislead you on that one
What type of stats do you want?
Avatar of Ryan_R

ASKER

I would imagine that the stats include items that you see when you r/click a file in Windows and choose Properties
Or if you show a folder in the 'Details' view

This would show you stuff like File Size, Date Modified, etc

However - I only want it to show these stats for the one file ($strFilename) - and not list the whole directory contents.  Is this possible?

Thanks (increasing points a bit)
Avatar of Ryan_R

ASKER

Perhaps the wc command will help - I'm unsure of it's extensions though
ASKER CERTIFIED SOLUTION
Avatar of hongjun
hongjun
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
File size

echo $(wc -c <FILENAME)
Avatar of Ryan_R

ASKER

Thanks hongjun

As it turns out, using    stat FILE    provides what I need.