alekg (alekg) wrote in lpi_help,
alekg
alekg
lpi_help

ls

ls     list directory contents


This is one of the most basic commands you will learn in Linux. ls has been around since Unix was around. Over the years it has acquired a lot of options. In this posting I will go over the most common ones and not so common one that will be asked in the LPI test.


ls [options] ... [FILE] ...


-a or --all     do not hide . entries. Print all files
--author      print author of each file
-B or --ignore-backups     ignore backups
-C      list entries by column
--color=[When]     controls whether color can be used to
              distinguish file types. The options are never, always or auto
-F or --classify     classify based on file types. Append (*,/,=,@,|).
-h or --human-readable     print size in human readable              format(mgs,gigs,k's)
-si     same as -h but uses power of 1000 instead of power of 1024
-i     prints inodes
-l     use long listing
-m     Fill listing with a comma separated listing of entries
-n or --numeric-uid-gid     like -l but list uid's and gid's numerically
-p or --file-type     same a -F
-Q or --quote-name     enclosed entries in double quotes
-r or --Reverse     Sort in reverse
-R or --recursive     display directories recursively
-s or --size     print size of each file in blocks

-S     sort by file size
-t     sort by modification time
-x     lists entries by lines instead of columns
-X     Sort alphabetically by file extention
--version     prints version information

--help     lists entries by lines instead of columns

As you can see there are a lot of options for ls. Obviously you are not going to remember and use all of the options. Although some can be very useful in scripts,some users use them depending on situation in hand. One can also create a alias with this crazy options in his/hers profile. As for the LPI the basic options should suffice. Email me @ lincerts@gmail.com for other options to include for testing purposes and I will more stuff later. For the rest use the comment link.
Tags: ls command
  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 0 comments