lsd is a file manager for the terminal, on macOS and Linux. It opens a Finder
window in your terminal: a full browser with vim keys, a preview pane, Quick
Look and file operations. It also prints files with real thumbnails, like
ls. The name is ls + display. lsd is written in Rust, free, and MIT
licensed.
This is not LSDeluxe, the ls replacement
that brew install lsd installs. See Questions.
Try it in your browser at lsd.today.
- Thumbnails for pictures, videos, PDFs, book covers and app icons, from QuickLook on macOS and the freedesktop thumbnailers on Linux. Code and JSON preview as colored text, and Markdown as formatted text.
.envfiles preview with their values hidden. Presszvto show them.- Archives open like folders:
.zip,.tar, and.tarwith gzip, bzip2, xz or zstd.Xextracts one. See Archives. - CSV and TSV files open as a table you can scroll, sort, search and edit. See Tables.
- SQLite databases open in an explorer: browse tables, edit rows, and run SQL with completion. See Databases.
- Web pages preview as the page itself, drawn by WebKit on macOS and by
Chrome, Chromium, Brave or Edge on Linux (
chrome-headless-shellis fastest). They load only files from the page's own folder and never touch the network. Until the picture is ready, or with no browser, you see the source. - Icons, list, columns and gallery views, Finder-style dates, sizes and kinds.
- Folder sizes, like Finder's "Calculate all sizes", in the list view and the preview pane. Sorting by size uses them. See Folder sizes.
- Mouse support: click, double click, a right-click menu, and scrolling
the files or the preview. Press
zmto turn it off and select text instead. - Git aware: changed files are marked, and the preview pane shows a changed file's diff.
- Matches your terminal's colors on its own, light or dark. The accent is your cursor color when it is a color, else your theme's blue.
- A sidebar like Finder's: favorites, the last five folders you visited
(kept in
~/.local/state/lsd/recent), and disks. - Storage: what fills your disk and what can go, from caches and build
folders to copies of your files, apps and Docker.
lsd --dfopens it. See Storage. - PDFs, EPUBs, Markdown and office files open in Leaf, right in the terminal. Quit Leaf and you are back where you were. See Leaf for the list.
- Code and other text files open in your editor, Neovim unless you pick another. See Editor.
- Fast: a folder of pictures lists in under 10 ms, and the browser builds a frame in well under a millisecond.
curl -fsSL https://lsd.today/install.sh | shIt works on macOS (Apple silicon and Intel) and Linux (x86_64 and ARM, any
distro). It downloads lsd from the latest release, checks it against its
SHA-256 and puts it in ~/.local/bin. It also installs Leaf next to it with
Leaf's own installer, unless you already have it. To update lsd later, run
lsd --update.
To put lsd somewhere else, set LSD_INSTALL_DIR:
curl -fsSL https://lsd.today/install.sh | LSD_INSTALL_DIR=~/bin shTo uninstall lsd and its thumbnail cache, run lsd --uninstall, or:
curl -fsSL https://lsd.today/uninstall.sh | shEither way, it leaves Leaf and your shell config alone, and tells you what's left.
Or by hand: download lsd for your machine from the latest release, or build it with Rust:
cargo install --locked --git https://github.com/vkpdeveloper/lsd lsd
curl -fsSL https://leaf.dipxsy.app | sh # optional, for documentsLSDeluxe, the ls replacement, also installs a command called lsd.
Whichever comes first on your PATH wins.
lsd # browse this folder
lsd ~/Downloads # browse another folder
lsd -p # print the icon view of this folder
lsd -l ~/Downloads # print the list view: date modified, size, kind
lsd -T -L 2 # print a tree, two levels deep
lsd -g photos/ # print a gallery: a large preview of each item
lsd data.json # one file: pretty-printed JSON, colored code
lsd page.html # one file: the page as a picture
lsd --df # what fills the disk, and what can be clearedlsd prints instead of browsing when you pass a view flag, more than one
path or a file, or when its output goes to a pipe. lsd -i browses anyway.
Sort with -t (date), -S (size), -X (kind), -r to reverse, and
--dirs-first. -a shows hidden files, and -s small|medium|large|huge sets
the icon size. See lsd --help for the rest.
To end up in the folder you browsed to when you quit, add one line to your shell config:
| Shell | Line | File |
|---|---|---|
| zsh | eval "$(lsd --init zsh)" |
~/.zshrc |
| bash | eval "$(lsd --init bash)" |
~/.bashrc |
| fish | lsd --init fish | source |
~/.config/fish/config.fish |
It makes lsd a shell function that runs lsd and then moves your shell to
the folder you were in when you quit. Quit with Q to stay where you were.
Printing (lsd -l, lsd data.json, lsd | head) works as before.
The browser reads keys like vim. Counts work with moves and commands (5j,
3dd, 10G), and y and d take any move (yG, d3j). Press ? for the
list inside lsd, grouped by task, and / there to search it: copy path
finds yp.
The bottom line shows the few keys that fit what is selected: Enter Read
on a document, X Extract on an archive, gd Diff on a file git sees
changed. After you copy or cut something, it shows how many, and in another
folder p Paste here. Wait after the first key of a pair, such as g, z
or y, and a panel lists the keys that can follow. Esc cancels. Every key
can be changed in Settings.
| Keys | |
|---|---|
h j k l, arrows |
Move. In the list and columns, h and l go up and into folders |
gg G |
First, last (or the item a count names) |
Ctrl-d Ctrl-u, Page Down Page Up |
Half a page, a page |
H M L |
Top, middle, bottom of the screen |
0 $ |
Start, end of a row of icons |
fx ; , |
Next name starting with x, then the next or previous one |
/ |
Filter. n and N find the last filter again |
Ctrl-f Ctrl-g |
Find files, search inside files, anywhere in the project. See Find |
F Ctrl-Shift-f |
Find files anywhere in your home folder |
Enter |
Open: folders and archives in place, CSV files as a table, SQLite databases in the explorer, documents in Leaf, text and code in your editor, the rest in their app |
gx |
Open in the default app |
- Backspace |
Enclosing folder |
Ctrl-o Ctrl-i, [ ] |
Back, forward |
~ |
Home |
gs |
Pick a place in the sidebar: j k move, Enter goes there, Esc comes back |
gf :df |
Storage. See Storage |
gz :z words |
Jump to a folder with zoxide. See zoxide |
yy dd p |
Copy, cut, paste. x cuts too |
v V |
Select a range, then y, d or D. o jumps to the other end |
m |
Mark. yy, dd and D act on marked items |
yp yn |
Copy paths, names to the clipboard |
r I A |
Rename, with the cursor at the extension, the start, the end |
cw cc |
Replace the name and keep the extension, replace all of it |
R |
Rename many in your editor. See Rename many |
a |
New folder |
X |
Extract an archive. See Archives |
B |
Compress into a zip or tar archive, with a password if you like |
T |
Copy or move to a folder you pick, here or on a server. See Copy to |
# |
Tags. See Tags |
! |
Run one of your own actions on the selected or marked items. See Actions |
D Delete |
Move to the Trash. In the Trash, delete for good |
E |
Empty the Trash |
b |
Put back from the Trash. See Put Back |
w |
Tasks: copies, moves and moves to the Trash, with their progress, speed and time left. x stops the selected one, Esc closes |
u Ctrl-r |
Undo, redo. See Undo |
Space |
Quick Look |
gd gD |
Focus the diff in the preview pane, show it full screen. See Git |
zi zl zc zg |
Icons, list, columns, gallery |
zt zz zb, Ctrl-e Ctrl-y |
Scroll |
zh . |
Hidden files |
zv |
Values in .env files |
zm |
Mouse on or off. Off, the terminal selects text as usual |
zp zs |
Preview pane, sidebar |
s S |
Sort by, reverse |
zu |
Groups on or off. See Groups |
O |
Show in Finder |
:cd path, :12 |
Go to a folder, to item 12 |
g, :settings |
Settings. See Settings |
:fix |
Tell us what to fix. See Feedback |
t |
New tab on this folder |
gt gT |
Next, previous tab. 3gt goes to the third |
q :q |
Close the tab, or quit on the last one |
ZZ ZQ :qa |
Quit, with every tab |
Q |
Quit, and leave your shell where it was. See Shell setup |
The mouse works too. Click to select, double click to open, and click the top bar, any folder in its path, the sidebar and prompts. Shift-click or Ctrl-click marks. Right click opens a menu for the item, with your actions that fit it, or for the folder on empty space, with the key for each entry. Click an entry, or hold the right button, move to one and let go. The wheel scrolls whatever is under it, the files or the preview.
With two or more tabs, a tab bar shows under the top bar. Click a tab to
show it, or its × to close it. A middle click on a folder opens it in a new
tab. Each tab keeps its own folder, history, view, sort, groups and filter,
and the clipboard is shared, so you can copy in one tab and paste in another. With the
shell setup, the shell ends up in the folder of the tab you quit from.
g, (or :settings) opens the settings: how the browser starts, and every
key. j k move and h l change a setting. On a key, Enter waits for
you to press the new keys and a second Enter saves them, a adds another
key for the same thing and x removes one. r puts back the default, and
e opens the file in your editor. lsd reads the file again when
you quit the editor.
Every change is saved right away to ~/.config/lsd/config.toml, or
$XDG_CONFIG_HOME/lsd/config.toml when that is set. It is a
TOML file: settings at the top, keys in [keys], and
your actions in [actions."file name"]. A change on the settings
screen touches only its own line, so your comments and order stay.
view = "list"
show-hidden-files = true
sort = "size"
[keys]
"ctrl+d" = "half_page_down"
"g>h" = "home"
n = "unbind"| Setting | Values | Default |
|---|---|---|
view |
icons list columns gallery |
icons |
show-hidden-files |
true false |
false |
sort |
name kind date size |
name |
sort-reverse |
true false |
false |
folders-first |
true false |
false |
group-by |
none kind date size name |
none |
preview-pane |
true false |
true |
sidebar |
true false |
true |
mouse |
true false |
true |
icons |
emoji nerd none |
emoji |
usage-stats |
true false |
true, see Feedback |
Hidden files, the sort and the icons apply to printing too. Flags such as
-a, -t and -r, and LSD_ICONS, win over the file. Keys such as .
and zs change the browser until you quit, without touching the file. When
a line is wrong, lsd says which one and skips it. When the file isn't valid
TOML, lsd says where, starts with the defaults, and doesn't save over it.
lsd used to keep its settings in ~/.config/lsd/config, one name = value
per line. When only that file is there, lsd writes config.toml from it,
once, and leaves the old file as it was.
Each line of [keys] binds a trigger to an action, the way Ghostty does.
A trigger with anything but letters, digits, - and _ needs quotes:
"ctrl+d" = "half_page_down". Lines apply in order, so a later one wins.
- A key takes its modifiers before it, joined by
+:ctrl+d,ctrl+shift+f,alt+enter. The modifiers arectrl,alt,shiftandsuper.Gandshift+gare the same key. >joins keys pressed one after the other:g>g,z>h.- Keys with names:
enter,escape,tab,backspace,delete,insert,space,updownleftright(orarrow_upand so on),home,end,page_up,page_downandf1tof24. x = "unbind"freesxand the keys that start with it.clear = truefrees every key, the defaults too, but not your actions' keys.- Binding
galone freesgg,gxand the rest, and bindingg>qfreesgif it did something alone.yanddkeep the keys after them, since they wait for a move (yj,dG). - Keys after
yanddcome first: withnbound todown,ynstill copies the name, andyCtrl-ncopies this and the next. 1to9can't start a key, since they make counts.
The settings screen refuses a key that would break others and says why.
Every action, with its default keys
| Action | Default keys | |
|---|---|---|
down |
j ctrl+n down |
Down |
up |
k up |
Up |
left |
h left |
Left, or out of the folder |
right |
l right |
Right, or into the folder |
first |
g>g home |
First item |
last |
G end |
Last item |
row_start |
0 ^ |
Start of the row |
row_end |
$ |
End of the row |
half_page_down |
ctrl+d |
Half page down |
half_page_up |
ctrl+u |
Half page up |
page_down |
page_down |
Page down |
page_up |
ctrl+b page_up |
Page up |
screen_top |
H |
Top of the screen |
screen_middle |
M |
Middle of the screen |
screen_bottom |
L |
Bottom of the screen |
jump_to_letter |
f |
Next name starting with a letter |
next_letter |
; |
Same letter, next |
previous_letter |
, |
Same letter, previous |
scroll_down |
ctrl+e |
Scroll down |
scroll_up |
ctrl+y |
Scroll up |
open |
enter |
Open |
open_default |
g>x |
Open in default app |
parent |
- backspace |
Enclosing folder |
back |
ctrl+o [ |
Back |
forward |
tab ] |
Forward |
home |
~ |
Home |
pick_place |
g>s |
Pick a place in the sidebar |
storage |
g>f |
Storage |
zoxide |
g>z |
Jump with zoxide |
command_line |
: |
Command line |
settings |
g>, |
Settings |
filter |
/ |
Filter |
next_match |
n |
Next match |
previous_match |
N |
Previous match |
find_files |
ctrl+f |
Find files in the project |
search_text |
ctrl+g |
Search inside files |
find_home |
F ctrl+shift+f |
Find files in home |
clear |
escape |
Clear filter, then marks |
quick_look |
space |
Quick Look |
copy |
y |
Copy |
cut |
d |
Cut |
copy_selection |
Y |
Copy the selection |
cut_selection |
x |
Cut the selection |
paste |
p P |
Paste |
copy_path |
y>p |
Copy path |
copy_name |
y>n |
Copy name |
select_range |
v V |
Select a range |
other_end |
o |
Other end of the range |
mark |
m |
Mark |
rename |
r |
Rename |
rename_at_start |
I |
Rename from the start |
rename_at_end |
A |
Rename from the end |
replace_name |
c>w |
Replace the name |
replace_all |
c>c C |
Replace name and extension |
rename_many |
R |
Rename many in your editor |
new_folder |
a |
New folder |
extract |
X |
Extract an archive |
compress |
B |
Compress |
copy_to |
T |
Copy to… |
tags |
# |
Tags |
actions |
! |
Run an action |
trash |
D delete |
Move to Trash |
empty_trash |
E |
Empty the Trash |
put_back |
b |
Put back from the Trash |
undo |
u |
Undo |
redo |
ctrl+r |
Redo |
tasks |
w |
Copies and moves in progress |
reveal |
O |
Show in Finder |
view_icons |
z>i |
Icons |
view_list |
z>l |
List |
view_columns |
z>c |
Columns |
view_gallery |
z>g |
Gallery |
align_top |
z>t |
Selection at the top |
align_middle |
z>z |
Selection in the middle |
align_bottom |
z>b |
Selection at the bottom |
toggle_hidden |
z>h . |
Hidden files |
toggle_env_values |
z>v |
.env values |
toggle_preview |
z>p |
Preview pane |
toggle_sidebar |
z>s |
Sidebar |
toggle_mouse |
z>m |
Mouse |
sort |
s |
Sort by |
reverse_sort |
S |
Reverse the order |
toggle_groups |
z>u |
Groups |
diff |
g>d |
Diff |
full_diff |
g>D |
Full-screen diff |
help |
? |
All keys |
new_tab |
t |
New tab |
next_tab |
g>t |
Next tab |
previous_tab |
g>T |
Previous tab |
close_tab |
q |
Close tab, quit on the last |
quit |
Z>Z Z>Q |
Quit |
quit_stay_put |
Q |
Quit, shell stays put |
Your own commands for files. Put a script in ~/.config/lsd/actions and
make it executable (chmod +x), and lsd offers it on the items you select
or mark: in the right-click menu, and in the menu ! opens. The script gets
the items as arguments and runs in their folder, which $LSD_DIR holds too.
The folder reloads when it ends.
#!/bin/sh
# name: Convert to PNG
# files: *.heic *.heif
# run: background
# each: yes
sips -s format png "$1" --out "${1%.*}.png"Comments at the top of the script, starting with # or //, say how it is
offered and run. Each is optional:
| Comment | Values | Default |
|---|---|---|
name: |
What the menu calls it | From the file name: convert-to-png.sh is "Convert to png" |
files: |
Name patterns, like *.heic *.heif. * is any run of characters, ? any one |
Any name |
takes: |
files, folders or both |
files with patterns, else both |
count: |
one, many (two or more) or any |
any |
run: |
terminal: lsd steps aside, shows what the script prints and waits for a key. background: a task in the w list, while you go on |
terminal |
each: |
yes runs it once for each item, no once for all of them |
no |
An action shows up only when every item fits. [actions."file name"] in
config.toml says the same things, wins over the script, and can give the
action a key, which [keys] can change:
[actions."to-png.sh"]
files = ["*.heic", "*.heif", "*.jpg"]
key = "g>p"lsd only runs a script you pick. In the background, the bottom line shows
the last line it printed, or when it fails, the last line of its errors.
Ctrl-c stops a script in the terminal and leaves lsd running.
R opens the names of the marked items in your editor, one per
line. With nothing marked, it opens every item in the folder (or every match
of the filter). Change the names, save and quit, and lsd renames them.
lsd checks the whole list first and renames nothing if something is off: a
line added or removed, an empty line, a name with /, two items with the same
name, or a name another item in the folder already has. Swapping names works.
Lines you leave alone stay as they are. u undoes the whole rename.
u undoes the last file operation and Ctrl-r redoes it: renames (all of an
R at once), cut and paste, copy and paste, new folders, extracting an
archive, moving to the Trash and putting back from it.
- Undoing a copy, or an extract, moves what it made to the Trash.
- Undoing a new folder removes it, or moves it to the Trash if something is in it now.
- Undoing a move to the Trash puts the items back where they were.
- Undoing a put back moves the items to the Trash again.
- Deleting in the Trash, and emptying it, can't be undone, so both ask first.
- A paste or a move to the Trash you stop with
wandxkeeps the items it finished, anduundoes those. The item it was on is left as it was.
After an operation, the bottom line says what was done next to u Undo,
until the next key. If the files changed since, for example an item was
moved or its old name is taken, lsd says so and leaves everything as it is.
lsd keeps the last 100 steps in ~/.local/state/lsd/undo (or
$XDG_STATE_HOME/lsd/undo), so u still works after you quit and open it
again. All lsd windows share them: u undoes the last thing done in any
window, and a step undone in one is gone from the others.
In the Trash, b, or Put Back in the right-click menu, moves the selected
items back to where they were.
- If their folder is gone, lsd makes it again.
- If their name is taken there, they get a free one, like
notes 2.txt. Nothing is overwritten. - If lsd doesn't know where an item came from, it says so and leaves it in the Trash. On Linux that comes from the Trash's own record. On macOS, from lsd's record of what it moved to the Trash, or else from Finder's.
Like Finder's Use Groups, the icon and list views can show items in groups,
each under its name and count. Group by kind (Folders, Applications,
Documents, Images, PDF Documents and so on), date modified (Today,
Yesterday, Previous 7 Days, Previous 30 Days, then months and years), size or
first letter. zu turns groups on and off, and the right-click menu on empty
space or group-by in Settings picks how. The sort applies
inside each group. Columns and the gallery show items without groups.
The browser adds up what each folder holds in the background: the selected folder and the folders on screen first, then the rest. The list view's Size column, the preview pane and sorting by size use each total as it comes in, and the selection stays on the item you are on. The list view, a sort by size and groups by size measure every folder; the other views measure only the selected one.
A folder's size is the logical size of the files inside it, the number Finder
shows first, not the space they take on disk. It counts hidden and git-ignored
files, counts a file with several hard links once, doesn't follow symlinks and
stays on the folder's own disk. Items lsd can't read are skipped. Symlinks to
folders and disks mounted in the folder show --.
Sizes last while lsd runs. When lsd notices a change in the folder you are
in, it measures again the folders that changed and the folders above. Leaving
a folder stops its measuring. lsd -p and lsd -l don't measure folders, so
they stay as fast as ls.
Storage shows what fills your disk and what can be cleared. Open it with
lsd --df, gf, :df or Storage in the sidebar. It takes the place of the
files, like a folder: the sidebar and tabs stay, and Esc or Back returns to
where you were.
A bar on top shows how the disk is used: apps, developer files, photos,
movies, documents, music, caches, the Trash, and system data, which is what
the disk holds beyond everything lsd counted. Below it are four sections.
Tab or 1 to 4 switch between them.
| Section | What it lists |
|---|---|
| Cleanup | What comes back on its own: package manager and build caches, node_modules and build folders, app and editor caches, old logs and temp files, simulators, old versions of command line tools, installers and the Trash. Developer caches and what is safe to clear start picked. What may hold your own work, like site data, chat media, backups and Time Machine snapshots, waits unpicked under Check first |
| Your files | The same file in more than one place, and screenshots older than 90 days. Copies under 1 MB and project folders are left out |
| Apps | Apps by size, with the files each keeps in your home folder |
| Docker | Container logs, old builds, the build cache, unused images, stopped containers and unused volumes. Only when Docker is installed |
The details beside the list say what clearing the selected row touches, line by line.
| Key | Action |
|---|---|
j k, gg G |
Move |
Space m |
Pick, unpick |
Enter l |
Into the details. Space there leaves a line out, or picks which copy stays |
h Esc |
Back to the list. Esc on the list leaves Storage |
c |
Clear what is picked, once you press y |
r |
Look again |
L |
Docker only: keep logs small, at most 30 MB for each new container. Docker restarts |
Cleanup and Docker delete for good, and the question says so first. Files are
only deleted inside your home folder and your own temp folders; Homebrew,
Docker, uv, simulators, Time Machine and system package caches are cleared by
their own tools. What an open app uses waits until it quits. Copies, screenshots and apps go to the
Trash, so u puts them back. On Linux, an app from a package manager is
removed by it, in the terminal, which may ask for your password. Cleanup
writes down what it cleared in ~/.local/state/lsd/cleared.log.
Inside a git repository, the browser marks what changed and shows the
branch in the top bar, or the short commit when HEAD is detached, with
↑ and ↓ for commits ahead of and behind its upstream.
| Mark | |
|---|---|
M |
Modified |
A |
Added |
U |
Untracked |
R |
Renamed |
! |
Conflict |
• |
A folder with changes inside |
| dimmed name | Ignored |
When the selected file has changes, the preview pane shows its diff instead of the file: the file as it is now against the last commit, so staged and unstaged changes both show. Untracked files show as all added, a renamed file says where it came from, and a conflict shows git's conflict markers as added lines. Binary files keep their usual preview. Deleted files are not in the folder anymore, so only the folder's mark shows them.
gd moves the keys into the diff and gD shows it full screen:
| Keys | |
|---|---|
j k, Ctrl-d Ctrl-u, Ctrl-f Ctrl-b |
Scroll a line, half a page, a page |
gg G |
Top, bottom |
n N, ] [ |
Next, previous change |
h l, 0 |
Scroll sideways, back to the start |
Enter |
Full screen, and back to the pane |
Esc q gd |
Back to the files |
Diffs longer than 20,000 lines show their first 20,000. Plain lsd and
lsd -l don't ask git, so they stay as fast as ls.
Enter or l on an archive goes inside it, like a folder: .zip, .tar,
.tar.gz (.tgz), .tar.bz2 (.tbz2), .tar.xz (.txz) and .tar.zst
(.tzst). The path in the top bar shows the archive as part of the path,
every view, preview and Quick Look works inside, and yy copies items out
to paste with p in another folder. Nothing inside can be renamed,
deleted, cut or added to. Going up from the top of the archive takes you
back to its folder. gx still opens the archive in its usual app.
To go inside, lsd unpacks the archive in the background into its cache folder, and shows how far it got at the bottom. It keeps 2 GB of these and drops the ones used longest ago. An archive that changed is unpacked again. Archives over 1 GB, or over 100,000 items, are too large to go inside: extract them instead.
X, or "Extract to…" in the right-click menu, extracts the selected archive
into a new folder next to it, named after it: photos.zip gives photos,
or photos 2 when that is taken. When the archive holds a single folder,
you get that folder's contents, not a folder in a folder. Edit the path
before pressing Enter, with Tab to complete folder names, or press Esc
to cancel. You can keep browsing while it extracts, and press X again to
stop it. When it's done, the new folder is selected.
Items that would land outside the folder, and links that point outside it, are refused, so a hostile archive can't write anywhere else. Files keep their modified times and permissions, including the executable bit. Password protected zips, 7z and RAR files aren't supported.
Every host in ~/.ssh/config, and the files it includes, shows under
Servers in the sidebar. Click one, or pick it with gs, and lsd opens your
login folder there. There's nothing to set up: lsd runs your own ssh, so
keys, the agent, ProxyJump and ControlMaster work the way they do in a
terminal. Each server gets one connection, shared by every tab. When ssh
needs a password, a passphrase or to trust a new host key, lsd hands it the
terminal to ask, then carries on.
On a server you browse, preview, copy, move, rename, make folders and delete
the way you do here. Servers have no Trash, so D deletes for good, after
asking. Enter opens a file as a local copy, in your editor or its app, and
saving the copy puts it back on the server. yp copies paths the way scp
takes them, like web:/srv/www. Undo, extract, compress, find, folder
sizes, git and your actions only work on this computer.
:cd web: goes to your login folder on web, :cd web:logs to a folder in
it, and :cd web:/srv/www anywhere on it. In a server's folder, :cd paths
are on that server, and ~ is your login folder there.
T copies or moves the selected or marked items to a folder you pick by
browsing or by typing its path, on this computer or any server: from here
to a server, from a server to here, or from one server to another.
| Keys | |
|---|---|
Tab Shift-Tab |
Next, previous machine |
j k |
Move |
l Enter, h - |
Open a folder, go up |
c m |
Copy, move into the folder shown |
/ ~ |
Type a path, like ~/Downloads, on the machine shown. Tab completes a folder's name, Enter goes there |
Esc |
Cancel |
It opens where the last items went. The copy runs in the background with
its progress, speed and time left at the bottom, and w lists it. Between two servers, the files
stream through lsd, so the servers don't need to reach each other. A move on
one server is a rename, and a move between machines deletes the originals
only once the copy is whole. Nothing is overwritten: a name that's taken
gets a number, like notes 2.txt.
# adds and removes tags on the selected or marked items. On a Mac they're
Finder's tags, colors included, so Finder shows what you set in lsd and the
other way around. On Linux they're saved where KDE keeps them
(user.xdg.tags). Type to filter or to make a new tag, Enter (or Space)
puts a tag on or takes it off, and Tab changes its color.
Tagged items show colored dots, and the sidebar lists your tags: pick one to
see its files, wherever they are. In the filter, /#work keeps the items
tagged Work. lsd keeps a list of tagged files in
~/.local/share/lsd/tags.db, to find them fast and to keep tags on disks
that can't store them.
Ctrl-f finds files and folders by name anywhere in the project, and
Ctrl-g finds lines inside files. The project is the git repository you are
in, else the current folder. F finds them anywhere in your home folder, and
so does Ctrl-Shift-f in terminals that tell it apart from Ctrl-f, such as
Ghostty and kitty. Names match with a few typos allowed, and files you open
often and recently come first.
Files that .gitignore leaves out are left out here too, and so is the
.git folder. Outside a git repository, which includes the home folder,
hidden files and folders are left out as well, and so are folders of caches
and installed packages, such as node_modules and most of ~/Library.
| Keys | |
|---|---|
Tab |
Switch between names and contents, keeping what you typed |
Up Down, Ctrl-p Ctrl-n |
Move |
Enter |
Go to it: the folder, or the file in its folder |
Ctrl-o |
Open in your editor, at the line for a content match |
Esc |
Close |
The first search in a big folder waits for its index, and the count shows how far it got. After that it stays up to date as files change. The project and the home folder each keep their own index, so going from one to the other doesn't wait again. Searching inside files in the home folder reads them as it goes, so it's slower than in a project. What you opened is remembered in lsd's cache folder, never in the project.
If zoxide is on your PATH, lsd works with it. Without it, none of this shows.
gzlists the folders zoxide knows, best first. Type to narrow the list,↑↓to move,Enterto go there,Escto close.:z wordsgoes straight to the best match, likezin your shell.:z ..and:z ~/srcgo to that folder, and:zalone opens the list.- A folder you stay in for a second counts as a visit, so zoxide learns the
folders you browse to in lsd. Folders you only pass through don't count,
and
_ZO_EXCLUDE_DIRSapplies as it does in the shell.
Enter on a .csv or .tsv file opens it as a table. The header row and
row numbers stay in place as you scroll, and the line at the bottom shows
the whole of the selected cell. Columns of numbers are right-aligned and sort
by value. The separator is guessed from the first line: comma, semicolon,
tab or |.
| Keys | |
|---|---|
h j k l, Tab |
Move between cells |
gg G, 0 $ |
First, last row; first, last column |
Ctrl-d Ctrl-u, Ctrl-f Ctrl-b |
Half a page, a page |
s |
Sort by the column: up, down, then back to file order |
/ n N |
Search, next, previous match. A lowercase search ignores case |
Enter i |
Edit the cell. Enter keeps it, Tab keeps it and edits the next one, Esc cancels |
o O |
Add a row below, above |
dd |
Delete the row |
Ctrl-s |
Save |
? |
These keys |
q Esc |
Back to the files. With unsaved changes, lsd asks first |
Click a cell to select it, and scroll to move up and down. Saving rewrites only the rows you changed: the others keep their exact bytes, quotes and line endings. Sorting changes the view, not the file. Files over 256 MB open in their usual app.
Enter on a SQLite database opens it in an explorer, whatever the file is
called. Its tables and views are on the left with their row counts, and the
selected one fills the grid, with the same keys as Tables. Rows
load a page at a time, so a table with millions of rows opens at once. Column
headers show their types, NULL is shown slanted and dim so it never looks
like empty text, and BLOBs show their size. In the preview pane a database
lists its tables, their row counts and columns.
lsd opens the database read only. It writes only when you save edits or run a statement that changes something, and only then opens it for writing. If another app holds a lock, lsd says so after two seconds instead of waiting.
| Keys | |
|---|---|
h j k l, gg G, 0 $ |
Move, as in a table. h from the first column goes to the list of tables |
J K |
Next, previous table |
s, / n N |
Sort by the column, search |
Enter i |
Edit the cell. Ctrl-n sets it to NULL |
o |
Add a row |
dd |
Delete the row, or keep it again |
Ctrl-s |
Save every change in one transaction |
e E |
Show the SQL editor, ready to type, hide it |
Ctrl-r F5 |
Run the statement under the cursor. Enter does too when you're not typing |
Tab, Ctrl-n Ctrl-p |
Take a completion, pick another. Ctrl-Space shows them |
Up Down |
Earlier statements, from the first or last line |
Esc Ctrl-c |
Stop a running query; stop typing, then leave the editor |
? |
These keys |
q Esc |
Back to the files. With unsaved edits, lsd asks first |
Edits stay pending, marked in the grid, until Ctrl-s saves them all
together or none of them. Numbers typed into number columns stay numbers.
Only tables whose rows can be told apart (by their rowid or primary key) can
be edited: views and query results are read only. Completion knows the
keywords, functions, tables, columns with their types, and aliases, and
offers what fits where the cursor is: tables after FROM or JOIN, a
table's columns after alias., the columns in scope after SELECT or
WHERE. Results of a SELECT page and sort like a table. A statement that
changes rows says how many and reloads the tables.
The SQL editor works like vim. It opens in insert mode, ready to type, and
Esc goes to normal mode. There you have vim's moves with counts (h j k
l, w b e, 0 ^ $, gg G, f t ; ,, %, { }), d
c and y with a move or a text object (d2w, ciw, di(, da'), dd
cc yy, x s D C p P r J ~, and i a I A o O
to type again. u and Ctrl-r undo and redo. v and V select characters
or lines, for d y c p, or U u ~ to change their case. Pasted
text goes in as text in every mode, so normal mode never reads it as keys.
lsd opens documents with Leaf, a terminal reader by Deepanshu Mishra, shared under the MIT license. Leaf does the reading, and it does it well. Thank you, Deepanshu.
lsd still draws everything else itself: the listing, the thumbnails, the
preview pane and Quick Look. Leaf starts only when you open a file. In the
browser, Enter on one of these files opens it in Leaf, in the same terminal:
| Files | Extensions |
|---|---|
.pdf |
|
| Books | .epub |
| Markdown | .md .markdown .mdown .mkd |
| Word, PowerPoint, Excel | .docx .pptx .xlsx |
| OpenDocument spreadsheets | .ods |
Press Esc in Leaf to come back to lsd. gx opens any of these in
its usual app instead, and so does Enter when Leaf isn't installed.
Pictures, videos and older .doc, .xls and .ppt files open in their
usual app.
Enter on a code or text file that lsd has no viewer for opens it in your
editor, in the same terminal. Quit the editor and you are back in lsd, with
the folder up to date.
lsd uses the first of these that is set:
LSD_EDITOR, for lsd onlyVISUALEDITOR
When none is set, it picks the first one installed of Neovim, Helix, Vim, vi
and nano. A setting can carry options, like export LSD_EDITOR="hx" or
export LSD_EDITOR="code --wait". gx still opens the file in its usual app.
| Terminal | Pictures |
|---|---|
| Ghostty, kitty, Rex | kitty graphics |
| WezTerm, iTerm2 | iTerm2 images |
| Alacritty, Terminal.app, others | Colored half blocks and emoji icons |
In tmux, pictures and copying (yp, yn) need passthrough:
set -g allow-passthrough on
When it's off, lsd offers to fix it. On y, it adds that line to the
config file tmux reads (~/.tmux.conf or ~/.config/tmux/tmux.conf),
keeping a copy of the old one next to it (.lsd-backup on the end), and
turns it on in the running tmux, so pictures show right away.
In iTerm2, copying needs Settings > General > Selection > "Applications in terminal may access clipboard", which starts off. lsd offers to turn it on. iTerm2 picks it up at once, with no restart.
Press d at either question and lsd won't ask again. That's kept in
~/.local/state/lsd/fixes.
lsd tells the terminal which folder it shows, so a new tab or split in
Ghostty, iTerm2, WezTerm, kitty or Terminal.app opens there. In tmux it sets
the pane's #{pane_path}.
LSD_IMAGES=kitty|iterm|text picks the picture protocol yourself, and
LSD_ICONS=nerd|none (or --icons) picks the text icons.
:fix opens a box to say what's wrong or missing (:fix previews are blank fills it in). Enter sends it. If it can't go, the box stays open
with what you wrote, so you can try again.
The browser also counts its users, once a day. Neither says who you are. This is all that's sent:
| Sent | |
|---|---|
| Both | lsd's version, macOS or Linux and its version, the processor |
| The daily count | A random id, made on your computer and kept in ~/.local/state/lsd/usage, so each user counts once |
| Feedback | What you typed and the terminal's name, under a new random id each time, so it can't be tied to the count |
Never your name, files, folders, servers or settings. lsd asks PostHog, where it goes, not to work out a location from your IP address, and the project is set to drop the address.
Nothing is counted the first time lsd opens. It says it counts, and
counts from the next time. To stop it, turn off Usage stats in settings
(g,), set usage-stats = false, or set DO_NOT_TRACK=1. Feedback still
goes when you send it.
Only the release builds send anything. lsd built from source doesn't.
lsd is a free, open source file manager that runs in a terminal on macOS and
Linux. It shows files the way Finder does, with thumbnails, a sidebar, tabs,
a preview pane and Quick Look, and you drive it with vim keys or the mouse.
With a flag such as -l, or in a pipe, it prints a listing and exits, like
ls.
No. brew install lsd installs LSDeluxe, a
different project that replaces ls with a colored listing with icons. This
lsd is a file manager, and it installs with the command under
Install. Both put a command called lsd on your computer, and
the one that comes first on your PATH runs. Uninstalling this lsd leaves
LSDeluxe alone.
Ghostty, kitty, Rex, WezTerm and iTerm2 show real pictures. Other terminals, such as Alacritty and Terminal.app, show colored half blocks instead. See Terminals.
Yes. lsd.today runs a copy of lsd in the browser, on a pretend disk, with the same keys and mouse.
- Leaf by Deepanshu Mishra (MIT) reads documents for lsd. See Leaf for which ones.
- Find uses fff by Dmitriy Kovalenko (MIT).
- Code coloring uses the syntax definitions from bat, through two-face.
MIT. See LICENSE.