Ls


From Knoppix Documentation Wiki
Revision as of 01:59, 18 March 2006 by Harry Kuhman (Talk | contribs)

Jump to: navigation, search

ls The ls command is used to list files on linux based systems. GUI file managers are nice to use. However, ls can be used as a fast tool where a user does not have to click themselves to death.

ls -l 

List files in a directory in long directory information format.

ls -lrt

List files in a directory in long directory information format; reverse order; sorted by time.

ls -lart 

List files in a directory in long directory information format; a including hidden, ., dot files and directories; reverse order; sorted by time.

ls -l | egrep -i '^(d|l)'

The reason why you would want to venture into the command line world occurs when you start to pipe, |, the ls output into another command for customized list of files.

ls > myfiles.txt

This is one of the most useful ls commands. It allows you to redirect ls's output to a file with the name of your choice. The data in the file can be manipulated with your favorite editor. ls puts each file or directory on a newline in the file. Please see redirection for more information.