Sponsored Content
Full Discussion: ls...without ls?
Top Forums UNIX for Dummies Questions & Answers ls...without ls? Post 302373893 by thegeek on Sunday 22nd of November 2009 10:00:33 PM
Old 11-22-2009
if you want to see ls output without executing ls ... and permissions also.,

try stat.

stat -c '%A %n' *

Code:
$ stat -c '%A %n' *
drwx------ atop.d
drwx------ keyring-BqEeA5
drwx------ orbit-gdm
drwx------ orbit-sathiya
drwx------ pulse-PKdhtXMmr18n
drwx------ pulse-TOfOFmY3lXDd
srwxr-xr-x scim-bridge-0.3.0.socket-1000@localhost:0.0
srw------- scim-helper-manager-socket-sathiya
srw------- scim-panel-socket:0-sathiya
srw------- scim-socket-frontend-sathiya
drwx------ seahorse-5rUoxr
drwx------ ssh-ewfznM1773
-rw-r--r-- test
-rw-r--r-- test-etc-cron
drwx------ virtual-sathiya.JiIscg

If you want more informations, such as user id, group id, time of last modification, use appropriate format sequence in stat: stat(1): file/file system status - Linux man page
 
stat.h(3HEAD)							      Headers							     stat.h(3HEAD)

NAME
stat.h, stat - data returned by stat system call SYNOPSIS
#include <sys/types.h> #include <sys/stat.h> DESCRIPTION
The system calls stat, lstat and fstat return data in a stat structure, which is defined in <stat.h>. The constants used in the st_mode field are also defined in this file: #define S_IFMT /* type of file */ #define S_IAMB /* access mode bits */ #define S_IFIFO /* fifo */ #define S_IFCHR /* character special */ #define S_IFDIR /* directory */ #define S_IFNAM /* XENIX special named file */ #define S_INSEM /* XENIX semaphore subtype of IFNAM */ #define S_INSHD /* XENIX shared data subtype of IFNAM */ #define S_IFBLK /* block special */ #define S_IFREG /* regular */ #define S_IFLNK /* symbolic link */ #define S_IFSOCK /* socket */ #define S_IFDOOR /* door */ #define S_ISUID /* set user id on execution */ #define S_ISGID /* set group id on execution */ #define S_ISVTX /* save swapped text even after use */ #define S_IREAD /* read permission, owner */ #define S_IWRITE /* write permission, owner */ #define S_IEXEC /* execute/search permission, owner */ #define S_ENFMT /* record locking enforcement flag */ #define S_IRWXU /* read, write, execute: owner */ #define S_IRUSR /* read permission: owner */ #define S_IWUSR /* write permission: owner */ #define S_IXUSR /* execute permission: owner */ #define S_IRWXG /* read, write, execute: group */ #define S_IRGRP /* read permission: group */ #define S_IWGRP /* write permission: group */ #define S_IXGRP /* execute permission: group */ #define S_IRWXO /* read, write, execute: other */ #define S_IROTH /* read permission: other */ #define S_IWOTH /* write permission: other */ #define S_IXOTH /* execute permission: other */ The following macros are for POSIX conformance (see standards(5)): #define S_ISBLK(mode) block special file #define S_ISCHR(mode) character special file #define S_ISDIR(mode) directory file #define S_ISFIFO(mode) pipe or fifo file #define S_ISREG(mode) regular file #define S_ISSOCK(mode) socket file ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ SEE ALSO
stat(2), types.h(3HEAD), attributes(5), standards(5) SunOS 5.10 30 Aug 2002 stat.h(3HEAD)
All times are GMT -4. The time now is 01:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy