Linux Security Debian Slax Tiny Core Health

Linux

If a Computer Won't Start from a CD, DVD or USB Drive

Filesystems

Partitioning

Live CDs for Partitioning

Grub

Master Boot Record

Root Terminal

Root File Manager

Root Text Editor

File Ownership

File Permissions

List the Contents of a Directory

Change Directory

Mount a Drive or Partition

Mount an ISO Image Without Writing it to a CD or DVD

Download Large Files

Other Commands

Dial Up Modems

Linux Links


Other Links


Contact Details

Linux

List the Contents of a Directory

File Manager

You can see the contents of a directory using the file manager.


Terminal

When working in the terminal, you may want to list the contents of a directory using the terminal. Following is how to do this.


List the Contents of a Directory

To list the contents of a directory, type:

ls

ls stands for list.

For more details, type:

ls -l

-l stands for long.


Understand the Output

After typing "ls -l" you will see something like this:

total 36
-rw-r--r-- 1 joe staff 31787 2009-05-28 05:36 garden.jpg
drwxr-xr-x 1 joe staff 4096 2008-05-18 09:21 Records
-rw-rw-r-- 1 joe staff 8992 2009-05-15 20:27 results.odt
drwxr-xr-x 2 joe staff 4096 2008-07-21 08:06 Sales
-rw-r--r-- 1 joe staff 192 2009-05-05 03:41 todo.txt
1 2 3 4 5 6 7

Total

At the top you will see "total" followed by a number. This shows how many blocks are contained in this directory (there are normally 1024 bytes per block).


1st Column

The first letter in the first column shows the type of file. It may be:

-   file

d   directory

l   link

The following letters in the first column show Permissions.


2nd Column

Shows how many hard links there are for this file.


3rd Column

Shows the owner of the file.


4th Column

Shows the group to which the file belongs.


5th Column

Shows the file size in bytes. For directories, it shows the size of the directory, not its contents.


6th Column

Shows the date and time the file was last modified.


7th Column

Shows the file name.


Hidden Files

To view hidden files type:

ls -a

In Linux, hidden filenames start with a "."


You can combine -l and -a, and use:

ls -a -l

or

ls -al

More Information

For more information and other options, open the terminal and type:

man ls

for the manual, or

ls --help

for help.


< File Permissions

Change Directory >


© Copyright Guy Shipard 2008 - 2009