<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.specnext.dev/index.php?action=history&amp;feed=atom&amp;title=Dot%3Als</id>
	<title>Dot:ls - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.specnext.dev/index.php?action=history&amp;feed=atom&amp;title=Dot%3Als"/>
	<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Dot:ls&amp;action=history"/>
	<updated>2026-05-09T10:03:51Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://wiki.specnext.dev/index.php?title=Dot:ls&amp;diff=11413&amp;oldid=prev</id>
		<title>Myopian: Add documentation for ls.</title>
		<link rel="alternate" type="text/html" href="https://wiki.specnext.dev/index.php?title=Dot:ls&amp;diff=11413&amp;oldid=prev"/>
		<updated>2020-05-31T23:14:37Z</updated>

		<summary type="html">&lt;p&gt;Add documentation for ls.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= .LS dot command =&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;.ls --help&amp;lt;/code&amp;gt; entered at the basic prompt will print help.&lt;br /&gt;
&lt;br /&gt;
This utility provides directory listings.&lt;br /&gt;
&lt;br /&gt;
The help text is reproduced here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls - list directory contents&lt;br /&gt;
&lt;br /&gt;
ls [OPTION]... [FILE]...&lt;br /&gt;
&lt;br /&gt;
List information about FILEs&lt;br /&gt;
(the current dir by default).&lt;br /&gt;
&lt;br /&gt;
Sort entries alphabetically if&lt;br /&gt;
-StUX and --sort are not used.&lt;br /&gt;
&lt;br /&gt;
FILTER FILES&lt;br /&gt;
&lt;br /&gt;
-a, --all&lt;br /&gt;
  do not ignore .*&lt;br /&gt;
&lt;br /&gt;
-A, --almost-all&lt;br /&gt;
  ignore . and ..&lt;br /&gt;
&lt;br /&gt;
-B, --ignore-backups&lt;br /&gt;
  do not list *.bak&lt;br /&gt;
&lt;br /&gt;
Wildcards accepted.&lt;br /&gt;
&lt;br /&gt;
LIST STYLE&lt;br /&gt;
&lt;br /&gt;
-C&lt;br /&gt;
  list entries by columns&lt;br /&gt;
&lt;br /&gt;
-l&lt;br /&gt;
  use a long listing format&lt;br /&gt;
&lt;br /&gt;
-m&lt;br /&gt;
  comma separated list&lt;br /&gt;
&lt;br /&gt;
-x&lt;br /&gt;
  list entries by lines&lt;br /&gt;
&lt;br /&gt;
-1&lt;br /&gt;
  list one file per line&lt;br /&gt;
&lt;br /&gt;
--format=across : -x&lt;br /&gt;
--fromat=commas : -m&lt;br /&gt;
--format=horizontal : -x&lt;br /&gt;
--format=long : -l&lt;br /&gt;
--format=single-column : -1&lt;br /&gt;
--format=verbose : -l&lt;br /&gt;
--format=vertical : -C&lt;br /&gt;
&lt;br /&gt;
-s, --size&lt;br /&gt;
  print file size&lt;br /&gt;
&lt;br /&gt;
-w, --width=COLS&lt;br /&gt;
  set output width to COLS.&lt;br /&gt;
&lt;br /&gt;
--lfn=off&lt;br /&gt;
  print 8.3 filenames&lt;br /&gt;
&lt;br /&gt;
--lfn=on&lt;br /&gt;
  print lfn filenames&lt;br /&gt;
&lt;br /&gt;
--lfn=both&lt;br /&gt;
  print both 8.3 and lfn&lt;br /&gt;
&lt;br /&gt;
SORT METHOD&lt;br /&gt;
&lt;br /&gt;
-S&lt;br /&gt;
  sort by size largest first&lt;br /&gt;
&lt;br /&gt;
-t&lt;br /&gt;
  sort by time newest first&lt;br /&gt;
&lt;br /&gt;
-U&lt;br /&gt;
  do not sort&lt;br /&gt;
&lt;br /&gt;
-X&lt;br /&gt;
  sort by extension&lt;br /&gt;
&lt;br /&gt;
--sort=none : -U&lt;br /&gt;
--sort=size : -S&lt;br /&gt;
--sort=time : -t&lt;br /&gt;
--sort=extension : -X&lt;br /&gt;
&lt;br /&gt;
-r, --reverse&lt;br /&gt;
  reverse sort order&lt;br /&gt;
&lt;br /&gt;
--gdf,&lt;br /&gt;
--group-directories-first&lt;br /&gt;
  list directories before files&lt;br /&gt;
&lt;br /&gt;
FILE SIZE FORMAT&lt;br /&gt;
&lt;br /&gt;
-h, --human-readable&lt;br /&gt;
  sizes in K,M,G (*1024)&lt;br /&gt;
&lt;br /&gt;
--si&lt;br /&gt;
  sizes in KB,MB,GB (*1000)&lt;br /&gt;
&lt;br /&gt;
--block-size=SIZE&lt;br /&gt;
  sizes scaled by SIZE&lt;br /&gt;
&lt;br /&gt;
DATE-TIME FORMAT&lt;br /&gt;
&lt;br /&gt;
--time-style=long-iso&lt;br /&gt;
  2002-03-30 23:45&lt;br /&gt;
&lt;br /&gt;
--time-style=iso&lt;br /&gt;
  2002-03-30, 03-30 23:45&lt;br /&gt;
&lt;br /&gt;
--time-style=locale&lt;br /&gt;
  mar 30 2002 23:45&lt;br /&gt;
&lt;br /&gt;
DIRECTORY PROCESSING&lt;br /&gt;
&lt;br /&gt;
-d, --directory&lt;br /&gt;
  list dirs and do not enter&lt;br /&gt;
&lt;br /&gt;
-R, --recursive&lt;br /&gt;
  list subdirs recursively&lt;br /&gt;
&lt;br /&gt;
--system&lt;br /&gt;
  include system files&lt;br /&gt;
&lt;br /&gt;
OTHER&lt;br /&gt;
&lt;br /&gt;
--help&lt;br /&gt;
  print this help and exit&lt;br /&gt;
&lt;br /&gt;
--version&lt;br /&gt;
  print version info and exit&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;README.TXT&amp;lt;/code&amp;gt; from the source is reproduced here.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
This is a near complete implementation of unix &amp;quot;ls&amp;quot; that&lt;br /&gt;
is capable of sorting directories with thousands of entries.&lt;br /&gt;
&lt;br /&gt;
TODO:&lt;br /&gt;
&lt;br /&gt;
* Add different list styles&lt;br /&gt;
  Currently -l is always generated&lt;br /&gt;
&lt;br /&gt;
* Change listing format depending on column width&lt;br /&gt;
&lt;br /&gt;
* Add filename formatting with flag characters&lt;br /&gt;
  and filename colouring.&lt;br /&gt;
&lt;br /&gt;
* Parse the LS_COLOR environment variable for&lt;br /&gt;
  colouring information.  Currently this environment&lt;br /&gt;
  variable and TIME_STYLE are both read but only&lt;br /&gt;
  TIME_STYLE is processed.&lt;br /&gt;
&lt;br /&gt;
NOTES:&lt;br /&gt;
&lt;br /&gt;
The output format is limited to -l for now and chosen to&lt;br /&gt;
fit in 32 columns.  The default is to list 8.3 filenames.&lt;br /&gt;
&lt;br /&gt;
Try a variation like this one in 64 column mode:&lt;br /&gt;
&lt;br /&gt;
.ls --gdf -AR --time-style=locale --lfn=on&lt;br /&gt;
&lt;br /&gt;
USE OF MEMORY&lt;br /&gt;
&lt;br /&gt;
A directory queue is maintained in two 8k pages and is&lt;br /&gt;
always paged entirely into memory at mmu6 and mmu7 when&lt;br /&gt;
accessed.  The queue is fifo and exists in a circular&lt;br /&gt;
buffer occupying the 16k.  In recursive mode, directories&lt;br /&gt;
that need to be visited are pushed into this queue.  And&lt;br /&gt;
as directories are listed, they are popped out of the queue.&lt;br /&gt;
&lt;br /&gt;
An obstack holding file pointer records is held in main&lt;br /&gt;
memory from the end of the program (around address 43000)&lt;br /&gt;
to the top of memory.  Each file pointer record is a three-&lt;br /&gt;
byte pointer, the first byte indicating 8k page number and&lt;br /&gt;
the remaining two being a pointer into the page when it is&lt;br /&gt;
present in mmu7.  These file pointer records are fixed size&lt;br /&gt;
and grow like an expanding array so are easily sortable with&lt;br /&gt;
quicksort.  About 6000 records can be stored in main memory&lt;br /&gt;
allowing sorting of directories containing up to 6000 files.&lt;br /&gt;
&lt;br /&gt;
Each file pointer record points at an actual file record.&lt;br /&gt;
These records are stored in extra 8k pages called LFN_PAGES.&lt;br /&gt;
A file record records 8.3 and lfn names, as well as time and&lt;br /&gt;
size information.  An individual record is variable in size&lt;br /&gt;
because the lfn name is variable in size.  Each page storing&lt;br /&gt;
records is managed by an obstack which will allocate memory&lt;br /&gt;
as needed.  The number of pages available is statically&lt;br /&gt;
compiled into the program and is currently four which means&lt;br /&gt;
32k is available to store file records.  Realistically this&lt;br /&gt;
places a much lower limit on the max number of files that&lt;br /&gt;
can be read from a directory at once, ie less than 6000.&lt;br /&gt;
If the limit is reached, the directory listing is split into&lt;br /&gt;
pieces.  If more space is needed, more pages can be allocated&lt;br /&gt;
by changing a constant and re-building the program.&lt;br /&gt;
&lt;br /&gt;
Utilities like .ls must co-exist with basic, as in they must&lt;br /&gt;
not disturb basic&amp;#039;s state.  This means .ls must allocate memory&lt;br /&gt;
from the operating system to load into and it must deallocate&lt;br /&gt;
that memory on exit.  All tasks are taken care of automatically&lt;br /&gt;
when z88dk builds this type of dot command called &amp;quot;dotn&amp;quot;.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Building ==&lt;br /&gt;
&lt;br /&gt;
Source [https://gitlab.com/thesmog358/tbblue/-/tree/master/src/c/DotCommands/ls here].&lt;br /&gt;
&lt;br /&gt;
[[Category:Developer Tools]]&lt;/div&gt;</summary>
		<author><name>Myopian</name></author>
	</entry>
</feed>