ls -l | awk '{print $5, $6, $7, $9}'
Questo stamperà la dimensione del file in byte, mese, data e nome file.
[email protected] /tmp/foo % ls -l
total 0
drwxr-xr-x 2 jin wheel 68 Oct 4 12:43 bar
drwxr-xr-x 2 jin wheel 68 Oct 4 12:43 baz
drwxr-xr-x 2 jin wheel 68 Oct 4 12:43 quux
[email protected] /tmp/foo % ls -l | awk '{print $5, $6, $7, $9}'
68 Oct 4 bar
68 Oct 4 baz
68 Oct 4 quux
Tecnicamente, non è possibile con ls
, ma find
può fare lo stesso lavoro con il suo -printf
interruttore:
find -maxdepth 1 -printf '%t %s %p\n'
puoi sempre fare:
$ ls -l
total 0
-rw-r--r-- 1 user staff 0 Oct 6 23:29 file1
-rw-r--r-- 1 user staff 0 Oct 6 23:29 file2
-rw-r--r-- 1 user staff 0 Oct 6 23:30 file3
-rw-r--r-- 1 user staff 0 Oct 6 23:30 file4
-rw-r--r-- 1 user staff 0 Oct 6 23:30 file5
-rw-r--r-- 1 user staff 0 Oct 6 23:30 file6
-rw-r--r-- 1 user staff 0 Oct 6 23:30 file7
cut
a:
$ ls -l | cut -f 8-13 -d ' '
0 Oct 6 23:29 file1
0 Oct 6 23:29 file2
0 Oct 6 23:30 file3
0 Oct 6 23:30 file4
0 Oct 6 23:30 file5
0 Oct 6 23:30 file6
0 Oct 6 23:30 file7
$