Difference between revisions of "Ls"


From Knoppix Documentation Wiki
Jump to: navigation, search
(Init from PHPWiki)
 
m (Reverted edits by 203.158.221.227 (Talk); changed back to last version by Harry Kuhman)
 
(10 intermediate revisions by 8 users not shown)
Line 14: Line 14:
 
   
 
   
 
  [[ls]] > myfiles.txt
 
  [[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.
+
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.
  
  
  
 
[[Category:Useful Linux Commands]]
 
[[Category:Useful Linux Commands]]

Latest revision as of 05:31, 15 July 2008

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.