liveBook · Manning

Ls

As explained in Build Applications with Local AI Models on a Mac

A command-line utility that lists the contents of a directory.

Use `ls` when you want to see what is in a folder without opening it in Finder. It stands for “list” and shows the files and folders in your current directory. For example, in your Mac home directory, you might see Documents, Downloads, and Pictures. section 1.7.2

Add options when you need a different view:

  • `ls -1p` puts one item on each line and adds a slash after folder names. These options change the display, not what is in the folder. section 1.7.2
  • `ls -la` combines two options: `-l` shows details such as permissions, owner, size, and date; `-a` includes hidden names that begin with a dot. section 1.7.2
total 0
drwxr-x---+ 15 yourname  staff   480 Feb 10 09:32 .
drwxr-xr-x   5 root      wheel   160 Jan  5 14:20 ..
drwx------   4 yourname  staff   128 Feb  8 11:15 .Trash
drwx------+  5 yourname  staff   160 Feb 10 09:32 Desktop
drwx------+  8 yourname  staff   256 Feb  9 14:22 Documents
drwx------+  3 yourname  staff    96 Feb  7 10:00 Downloads
...

In this `ls -la` listing, `.Trash` is a hidden folder. The entries `.` and `..` mean the current directory and its parent; they are navigation shortcuts, not hidden files. section 1.7.2

When you press Enter after typing `ls`, the terminal passes the command to the shell. The shell finds the `ls` program through `PATH`; the program reads the current directory, and the terminal displays its result. Use `pwd` to check where you are and `cd` to change directories before listing another folder. section 1.7.5 section 1.9

How Build Applications with Local AI Models on a Mac covers it

How deep it goes
Defines the command, compares display options, explains hidden entries, and traces execution through the shell and PATH.
Examples
Shows Mac home-directory folders, `ls -1p`, and a detailed `ls -la` listing containing `.Trash`, `.`, and `..`.
What it assumes
Starts without assuming terminal knowledge, defining options and explaining how the terminal and shell handle a command.
What you can do after
Operate/configure it to inspect the current directory, change the listing’s layout, and reveal hidden entries and file details.
How it connects
Connects filesystem navigation and command-line options to the shell, PATH, and the terminal.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build Applications with Local AI Models on a Mac. The section links point to the parts of the book it draws on.