Difference between revisions of "Ls"

From wikieduonline
Jump to navigation Jump to search
 
(36 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<code>[[wikipedia:ls|ls]]</code> is a command to list computer files in [[Linux]] and Unix and Unix-like operating systems.
+
{{lowercase}}
 +
<code>[[wikipedia:ls|ls]]</code> is a command to list files, [[directories]] and [[symbolic links]] in [[Linux]] and Unix-like operating systems include in the <code>[[coreutils]]</code> package in Ubuntu.
 +
* Man page: http://man7.org/linux/man-pages/man1/ls.1.html
  
  
 
== Linux Examples ==
 
== Linux Examples ==
 
* <code>ls</code>
 
* <code>ls</code>
* <code>ls -lhaR</code>
+
* <code>ll</code> ([[alias]] from <code>ls -laF</code>)
 +
** <code>ll -h</code>
 +
* <code>ls -l</code>
 +
* <code>[[ls -la]]</code>
 +
* <code>ls -lh</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 -lR | grep '^-' | sort -rnk5</code> (sort will not work if ls is used with -h)
+
** <code>ls -lhS</code>
** Including full path: <code>ls -ld $([[find]] ./) | sort -rnk5</code>
+
** <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 | more</code>
 
:::-su: /bin/ls: Argument list too long
 
:::-su: /bin/ls: Argument list too long
 +
::: -d list directories themselves, not their contents
 +
* <code>ls -i</code> ([[inode]])
 +
* <code>[[ls -1]]</code>
 +
* <code>ls | xargs</code>
  
== Related commands ==
+
== Flags ==
 +
<code>-F</code> appends symbols to filenames. These symbols show useful information about files.<ref>https://unix.stackexchange.com/questions/82357/what-do-the-symbols-displayed-by-ls-f-mean</ref>
 +
@ means symbolic link (or that the file has [[extended attributes]]).
 +
* means executable.
 +
= means socket.
 +
| means named pipe.
 +
> means door.
 +
/ means directory.
 +
 
 +
== Related terms ==
 +
* [[No space left on device]]
 
* <code>[[find]]</code>
 
* <code>[[find]]</code>
 
* <code>[[du]]</code>
 
* <code>[[du]]</code>
 
* <code>[[df]]</code>
 
* <code>[[df]]</code>
 
+
* <code>[[chown]]</code>,  <code>[[chgrp]]</code>
 +
* [[MinIO]]: <code>[[mc ls]]</code>
 +
* <code>[[lscpu]], [[lsusb]], [[lspci]], [[lshw]], [[lsmem]], [[lspci]]</code>
 +
* [[Superblock]]
 +
* [[nvm ls]]
 +
* <code>[[lsdir]]</code> [[alias]]
  
 
== See also ==
 
== See also ==
 +
* {{ls}}
 
* {{Linux filesystem commands}}
 
* {{Linux filesystem commands}}
 +
* {{Linux Commands privileges}}
 
* {{du}}
 
* {{du}}
  
 
[[Category:Linux commands]]
 
[[Category:Linux commands]]

Latest revision as of 13:30, 28 September 2023

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[edit]

  • ls
  • ll (alias from ls -laF)
    • ll -h
  • ls -l
  • ls -la
  • 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 | more
-su: /bin/ls: Argument list too long
-d list directories themselves, not their contents

Flags[edit]

-F appends symbols to filenames. These symbols show useful information about files.[1]

@ means symbolic link (or that the file has extended attributes).
* means executable.
= means socket.
| means named pipe.
> means door.
/ means directory.

Related terms[edit]

See also[edit]

  • https://unix.stackexchange.com/questions/82357/what-do-the-symbols-displayed-by-ls-f-mean
  • Advertising: