Saturday, July 26, 2014

Enumerate ls and perform ops by listing index number

(precise)root@localhost:~# ls | cat -n
     1    chrome_touchpad
     2    Desktop
     3    Documents
     4    Downloads
     5    Music
     6    Pictures
     7    Public
     8    Templates
     9    Videos

(precise)root@localhost:~# ls | sed -n '3p;8p' | xargs stat
  File: `Documents'
  Size: 4096          Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d    Inode: 130070      Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-07-18 21:30:27.929137260 -0400
Modify: 2014-05-19 11:40:05.358916751 -0400
Change: 2014-05-19 11:40:05.358916751 -0400
 Birth: -
  File: `Templates'
  Size: 4096          Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d    Inode: 13769       Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2014-07-18 21:30:27.961137260 -0400
Modify: 2014-05-19 11:40:05.358916751 -0400
Change: 2014-05-19 11:40:05.358916751 -0400
 Birth: -

No comments:

Post a Comment