Difference between revisions of "Ls"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 9: Line 9:
 
* <code>ls -lhaR</code>
 
* <code>ls -lhaR</code>
 
* One line listing with sizes using ls and find: <code>[[ls]] -ldh $([[find]] /path/to/search/)</code>
 
* One line listing with sizes using ls and find: <code>[[ls]] -ldh $([[find]] /path/to/search/)</code>
* Sort by size:  
+
* Sort by [[size]]:  
 +
** <code>ls -lhS</code>
 
** <code>ls -lR | grep '^-' | sort -rnk5</code> (sort will not work if ls is used with -h)
 
** <code>ls -lR | grep '^-' | sort -rnk5</code> (sort will not work if ls is used with -h)
 
** Including full path: <code>ls -ld $([[find]] ./) | sort -rnk5</code>
 
** Including full path: <code>ls -ld $([[find]] ./) | sort -rnk5</code>

Revision as of 17:26, 20 April 2020

ls is a command to list files, directories and symbolic links in Linux and Unix-like operating systems include in the coreutils package in Ubuntu.


Linux Examples

  • ls
  • ls -l
  • ls -lh
  • ls -lhaR
  • One line listing with sizes using ls and find: ls -ldh $(find /path/to/search/)
  • Sort by size:
    • ls -lhS
    • ls -lR | grep '^-' | sort -rnk5 (sort will not work if ls is used with -h)
    • Including full path: ls -ld $(find ./) | sort -rnk5
-su: /bin/ls: Argument list too long

Related commands


See also

Advertising: