Difference between revisions of "Ls"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 1: Line 1:
ls list files in a given directory. If no directory is given, it lists the files in the current working directory:
+
ls is a [[command]] that list files in a given directory. If no directory is given, it lists the files in the current working directory:
 
<pre>
 
<pre>
 
tweedleburg:~/svn/kdepim # ls
 
tweedleburg:~/svn/kdepim # ls
Line 18: Line 18:
 
== find out the free disk space ==
 
== find out the free disk space ==
 
You do not use ls, but df:
 
You do not use ls, but df:
  df -h
+
  [[df]] -h
 
tells you how much disk space is left.
 
tells you how much disk space is left.
  
 
== find out the size of a directory ==
 
== find out the size of a directory ==
Change to directory and:
+
You do not use ls, but du:
  du -sh
+
  [[du]] -sh ''directory''

Revision as of 11:19, 10 September 2011

ls is a command that list files in a given directory. If no directory is given, it lists the files in the current working directory:

tweedleburg:~/svn/kdepim # ls
.emacs-dirvars       README.Kolab           kdgantt1           ktimetracker
.kateconfig          akonadi                kitchensync        lib
[...]

How to...

only list directories

ls -d */

Sort by date

List with the latest changed files below:

ls -ltr

find out the free disk space

You do not use ls, but df:

df -h

tells you how much disk space is left.

find out the size of a directory

You do not use ls, but du:

du -sh directory