ls

From Initq

Jump to: navigation, search

ls is a command to list the files and directories in a filesystem.

Contents

--color

On most distros when you su, your lose all your colorful directories. Here is the flag that does the color on files and directories.

qais:/# ls
bin   cdrom  etc   initrd.img  lost+found  mnt  proc  sbin     srv  tmp  var
boot  dev    home  lib         media       opt  root  selinux  sys  usr  vmlinuz
qais:/# ls --color=always
bin   cdrom  etc   initrd.img  lost+found  mnt  proc  sbin     srv  tmp  var
boot  dev    home  lib         media       opt  root  selinux  sys  usr  vmlinuz

-a (absolutely all)

This flag will show the . and .. files also.

-l (long file name)

Show long file names and include, file flags (rwx), uid, gid, size, create date, create time.

--classify

append indicator (one of */=>@|) to entries.

  • * executable
  • @ link

-q

--hide-control-chars switch displays any unprintable characters in the filename as question marks.

-t

sort by modification time

[root@initq test]# ls -lt
total 16
-rw-r--r-- 1 lexiana lexiana 133 2007-10-02 00:06 file.txt
-rwxr-xr-x 1 lexiana lexiana 365 2007-09-23 14:23 validstring.sh*
-rw-r--r-- 1 lexiana lexiana  31 2007-09-23 13:59 hello
-rwxr-xr-x 1 lexiana lexiana 305 2007-09-23 13:50 loggedin.sh*

Directory Listings

# ls -d */
books/  classes/  droid/  index_icons/  languages/  phone/  templates/  weather/  webcam/

Sort By Size

  • ls -laSh

h = human readable

Personal tools