Table of Contents

About

ls is a Linux Command utility that lists the contents of a directory

  • ll is an alias of “ls -la”
  • You can also list files and directories with the find command

Example

Basic

ls -alt

How to monitor a directory for file changes?

cd /your/Directory/Path
while :; do ls -A1; sleep 1; clear; done;

This script will:

  • list the name of the files ls -A1 of the current directory
  • sleep one second
  • clear the screen
  • repeat until you break it with Ctr+C

Syntax

ls [option] [file}

Options

long format (l)

The -l option lists files and directories as a table with the following structure:

  • the number of child's (directory and file)
  • the owner name
  • the group owner name
  • the size of the file in bytes
  • the date and time of the last modification
  • the name of the file or directory

order (t)

The -t option orders files and directories by the time they were last modified.

hidden files and directory (a)

include hidden files and directories

Only file name

ls -A1