View file flags

hello:

how could i view the file's flags? "ls -loa" doesn't seem to do the trick:

root@giraffe:/etc # ls -alo
total 820
drwxr-xr-x  23 root  wheel     -  2048 Oct 23 19:48 .
drwxr-xr-x  19 root  wheel     -  1024 Nov 16 15:01 ..
drwxr-xr-x   2 root  wheel     -   512 Nov 11  2014 X11
lrwxr-xr-x   1 root  wheel     -    12 Nov 11  2014 aliases -> mail/aliases
-rw-r--r--   1 root  wheel     -   215 Nov 11  2014 amd.map
-rw-r--r--   1 root  wheel     -  1240 Nov 11  2014 apmd.conf
-rw-r--r--   1 root  wheel     -   169 Nov 11  2014 auto_master
drwxr-xr-x   2 root  wheel     -   512 Nov 11  2014 autofs
drwxr-xr-x   2 root  wheel     -   512 Nov 11  2014 bluetooth
-rw-r--r--   1 root  wheel     -   730 Nov 11  2014 crontab
-rw-r--r--   1 root  wheel     -   113 Nov 11  2014 csh.cshrc
-rw-r--r--   1 root  wheel     -   485 Nov 11  2014 csh.login
-rw-r--r--   1 root  wheel     -   115 Nov 11  2014 csh.logout
-rw-r--r--   1 root  wheel     -   567 Nov 11  2014 ddb.conf
drwxr-xr-x   2 root  wheel     -   512 Mar 14  2015 defaults
drwxr-xr-x   2 root  wheel     -   512 Nov 11  2014 devd

_dave

What operating system are you using? That is not the output that I would expect from the command ls -alo . The 4th and 5th columns in the output you showed us should not be there when using those options.

What file flags are you hoping to print?

thanks don:

root@giraffe:/etc # uname -a
FreeBSD giraffe 10.1-RELEASE-p35 FreeBSD 10.1-RELEASE-p35 #0: Sat May 28 03:02:45 UTC 2016     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386

I repeat:

hi don:

here it is:

chflags(1)

i want to see what kind of flags those files are set (by default).

By default, I wouldn't expect any flags, and that is probably what is being shown by the 5th column in your output being just a hyphen character.

To verify that, you might want to change directory to your home directory, use chflags to set some flags on some of your files and then use ls -lo on the files to which you added flags.

I have to second Don Cragun in his interpretation. No flags are set by default. Quick verification on FreeBSD 9.0-RELEASE shows:

touch XX
ls -loa XX
-rw-r--r--  1 root  wheel  - 0 Mar  6 23:58 XX
chflags opaque  XX
ls -loa XX
-rw-r--r--  1 root  wheel  opaque 0 Mar  6 23:58 XX
chflags arch  XX
ls -loa XX
-rw-r--r--  1 root  wheel  arch,opaque 0 Mar  6 23:58 XX
1 Like