Difference between revisions of "Ls"

From Linuxintro
imported>ThorstenStaerk
(New page: ls list files in a given directory. If no directory is given, it lists the files in the current working directory: <pre> tweedleburg:~/svn/kdepim # ls .emacs-dirvars README.Kolab ...)
 
imported>ThorstenStaerk
 
(9 intermediate revisions by 2 users not shown)
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
 
.emacs-dirvars      README.Kolab          kdgantt1          ktimetracker
 
.emacs-dirvars      README.Kolab          kdgantt1          ktimetracker
 
.kateconfig          akonadi                kitchensync        lib
 
.kateconfig          akonadi                kitchensync        lib
.krazy              akregator              kjots              libkdepim
+
[...]
.svn                cmake                  kleopatra          libkholidays
 
CMakeCache.txt      cmake_install.cmake    kmail              libkleo
 
CMakeFiles          cmake_uninstall.cmake  kmailcvt          libkpgp
 
CMakeLists.txt      console                kmobiletools      libksieve
 
CMakeTmp            date.txt              knode              maildir
 
COPYING              dependency-graph.dot  knotes            mimelib
 
COPYING.DOC          doc                    kode              plugins
 
COPYING.LIB          icons                  kontact            strigi-analyzer
 
CTestTestfile.cmake  install_manifest.txt  kontactinterfaces  usability-quick-review.txt
 
MAINTAINERS          kaddressbook          korganizer        wizards
 
Mainpage.dox        kalarm                korn
 
Makefile            kdepim-compat.h        kpilot
 
README              kdgantt                kresources
 
 
</pre>
 
</pre>
  
 
= How to... =
 
= How to... =
  
== list with the latest changed files below ==
+
== only list directories ==
 +
ls -d */
 +
 
 +
== Sort by date ==
 +
List with the latest changed files below:
 
  ls -ltr
 
  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''
 +
 +
= See also =
 +
* [http://unixhelp.ed.ac.uk/CGI/man-cgi?ls ls' man page]
 +
* [[stat]] -- date of last access, change and modification
 +
 +
[[Category:Command]]

Latest revision as of 14:54, 20 April 2014

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

See also