{"id":22,"date":"2011-04-29T11:58:36","date_gmt":"2011-04-29T09:58:36","guid":{"rendered":"http:\/\/www.tenzione.it\/?p=22"},"modified":"2011-04-29T11:58:36","modified_gmt":"2011-04-29T09:58:36","slug":"repost-micro-tipstricks-mtt1","status":"publish","type":"post","link":"https:\/\/www.tenzione.it\/?p=22","title":{"rendered":"[repost] Micro Tips&#038;Tricks (MTT1)"},"content":{"rendered":"<p><a title=\"ls\" href=\"http:\/\/unixhelp.ed.ac.uk\/CGI\/man-cgi?ls\">ls<\/a>, tra le tante opzioni disponibili, ne ha spesso qualcuna per cui si ignora l&#8217;esistenza cercando di ottenere lo stesso risultato a botte di pipe, grep e sort.<\/p>\n<p>E&#8217; il caso di <strong>-S, sort for file size<\/strong>, ad esempio, che produce degli utili output del tipo:<\/p>\n<p><code><br \/>\nmizio@ubuntu-fly:\/usr\/share\/doc\/coreutils$ ls -Slhr<br \/>\ntotal 104K<br \/>\n-rw-r--r-- 1 root root  335 2006-09-18 10:46 README.Debian<br \/>\n-rw-r--r-- 1 root root  465 2006-09-18 10:46 NEWS.Debian.gz<br \/>\n-rw-r--r-- 1 root root 1,7K 2006-09-18 10:50 buildinfo.gz<br \/>\n-rw-r--r-- 1 root root 2,2K 2006-09-18 10:50 THANKS-to-translators<br \/>\n-rw-r--r-- 1 root root 2,9K 2006-09-18 10:50 AUTHORS<br \/>\n-rw-r--r-- 1 root root 3,7K 2006-09-18 10:50 README.gz<br \/>\n-rw-r--r-- 1 root root 4,4K 2006-09-18 10:50 TODO.gz<br \/>\n-rw-r--r-- 1 root root 7,2K 2006-09-18 10:46 copyright<br \/>\n-rw-r--r-- 1 root root 8,7K 2006-09-18 10:46 changelog.Debian.gz<br \/>\n-rw-r--r-- 1 root root 9,8K 2006-09-18 10:50 THANKS.gz<br \/>\n-rw-r--r-- 1 root root  16K 2006-02-07 09:31 changelog.gz<br \/>\n-rw-r--r-- 1 root root  22K 2006-09-18 10:50 NEWS.gz<\/code><\/p>\n<p>Ovvero, output human readable (-h), ordinate per dimensione (-S), in formato esteso (-l) e in ordine inverso (-r), ovvero dal minore al maggiore.<\/p>\n<p>Un&#8217;altra combinazione che uso spesso, e facile da memorizzare \u00e8:<\/p>\n<p><code><br \/>\nmizio@ubuntu-fly:\/usr\/share\/doc\/coreutils$ ls -lart<br \/>\ntotal 136<br \/>\n-rw-r--r--    1 root root 15938 2006-02-07 09:31 changelog.gz<br \/>\n-rw-r--r--    1 root root   335 2006-09-18 10:46 README.Debian<br \/>\n-rw-r--r--    1 root root   465 2006-09-18 10:46 NEWS.Debian.gz<br \/>\n-rw-r--r--    1 root root  7367 2006-09-18 10:46 copyright<br \/>\n-rw-r--r--    1 root root  8852 2006-09-18 10:46 changelog.Debian.gz<br \/>\n-rw-r--r--    1 root root  4489 2006-09-18 10:50 TODO.gz<br \/>\n-rw-r--r--    1 root root  2239 2006-09-18 10:50 THANKS-to-translators<br \/>\n-rw-r--r--    1 root root 10013 2006-09-18 10:50 THANKS.gz<br \/>\n-rw-r--r--    1 root root  3753 2006-09-18 10:50 README.gz<br \/>\n-rw-r--r--    1 root root 22473 2006-09-18 10:50 NEWS.gz<br \/>\n-rw-r--r--    1 root root  2968 2006-09-18 10:50 AUTHORS<br \/>\n-rw-r--r--    1 root root  1704 2006-09-18 10:50 buildinfo.gz<br \/>\ndrwxr-xr-x    2 root root  4096 2006-10-27 10:46 .<br \/>\ndrwxr-xr-x 1230 root root 28672 2007-02-25 16:22 ..<\/code><\/p>\n<p>Che ha il grande pregio di mostrare in ordine inverso, ovvero <strong>sotto<\/strong>, gli ultimi file modificati, mediante l&#8217;uso di <strong>-t sort by modification time<\/strong>.<\/p>\n<p><em>addenda<\/em>: nei commenti, poi, AP, aggiunse che &#8220;\u00e8 meglio -lArt di -lart (non mostra le directory . e ..)&#8221;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ls, tra le tante opzioni disponibili, ne ha spesso qualcuna per cui si ignora l&#8217;esistenza cercando di ottenere lo stesso risultato a botte di pipe, grep e sort. E&#8217; il caso di -S, sort for file size, ad esempio, che produce degli utili output del tipo: mizio@ubuntu-fly:\/usr\/share\/doc\/coreutils$ ls -Slhr total 104K -rw-r&#8211;r&#8211; 1 root root [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10,12,9],"tags":[23,27,28,20,16],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-tensioni","category-ti-ricordi","category-trucchi","tag-console","tag-ls","tag-mtt","tag-tips","tag-vecchi-post"],"_links":{"self":[{"href":"https:\/\/www.tenzione.it\/index.php?rest_route=\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tenzione.it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tenzione.it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tenzione.it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tenzione.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=22"}],"version-history":[{"count":2,"href":"https:\/\/www.tenzione.it\/index.php?rest_route=\/wp\/v2\/posts\/22\/revisions"}],"predecessor-version":[{"id":24,"href":"https:\/\/www.tenzione.it\/index.php?rest_route=\/wp\/v2\/posts\/22\/revisions\/24"}],"wp:attachment":[{"href":"https:\/\/www.tenzione.it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tenzione.it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tenzione.it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}