sfm

Simple File Manager
git clone git://git.emmett1.my/sfm.git
Log | Files | Refs | README | LICENSE

sfm.1 (6242B)


      1 .TH SFM 1 "2026-03-16" "0.4" "Simple File Manager"
      2 
      3 .SH NAME
      4 sfm \- Simple File Manager
      5 
      6 .SH SYNOPSIS
      7 .B sfm
      8 .RI [ path ]
      9 
     10 .SH DESCRIPTION
     11 .B sfm
     12 is a lightweight, terminal-based file manager written entirely in POSIX sh.
     13 It runs in your terminal with no external dependencies beyond standard Unix
     14 tools. Designed to be fast, flicker-free, and keyboard-driven with a
     15 vim-inspired key layout.
     16 
     17 If
     18 .I path
     19 is given, sfm opens that directory. Otherwise it opens in the current
     20 working directory.
     21 
     22 .SH KEY BINDINGS
     23 
     24 .SS Navigation
     25 .TP
     26 .BR j ", " k " or " "up/down arrows"
     27 Move cursor up or down.
     28 .TP
     29 .BR h " or " "left arrow"
     30 Go to parent directory.
     31 .TP
     32 .BR l ", " "right arrow" ", or " enter
     33 Open selected file or enter directory.
     34 .TP
     35 .B g
     36 Jump to top of list.
     37 .TP
     38 .B G
     39 Jump to bottom of list.
     40 .TP
     41 .B ~
     42 Go to home directory.
     43 .TP
     44 .B \`
     45 Jump to previous directory (toggle).
     46 
     47 .SS Search and Filter
     48 .TP
     49 .B /
     50 Enter search mode. The listing is filtered as you type.
     51 .TP
     52 .B esc
     53 Clear filter and exit search mode.
     54 .TP
     55 .B enter
     56 Exit search mode while keeping the current filter active.
     57 
     58 .SS Display Toggles
     59 .TP
     60 .B .
     61 Toggle hidden files (dotfiles).
     62 .TP
     63 .B T
     64 Toggle size/date detail column.
     65 .TP
     66 .B P
     67 Toggle preview pane on the right side.
     68 .TP
     69 .B s
     70 Cycle sort mode: name \-> size \-> date.
     71 .TP
     72 .B i
     73 Show file info (permissions, size, date) in the status bar.
     74 .TP
     75 .B R
     76 Refresh the current directory listing.
     77 
     78 .SS File Operations
     79 .TP
     80 .B r
     81 Rename selected entry. Press esc to cancel.
     82 .TP
     83 .B m
     84 Create a new directory. Press esc to cancel.
     85 .TP
     86 .B n
     87 Create a new empty file. Press esc to cancel.
     88 .TP
     89 .B d
     90 Delete selected entry or all multi-selected entries.
     91 Non-empty directories require a second confirmation.
     92 .TP
     93 .B u
     94 Move selected entry to trash (safe delete).
     95 .TP
     96 .B U
     97 Open the trash directory.
     98 .TP
     99 .B o
    100 Open selected file with a custom program. Press esc to cancel.
    101 
    102 .SS Clipboard
    103 .TP
    104 .B y
    105 Yank (copy) selected entry or all multi-selected entries.
    106 .TP
    107 .B x
    108 Cut selected entry or all multi-selected entries.
    109 .TP
    110 .B p
    111 Paste clipboard contents into the current directory.
    112 .TP
    113 .B c
    114 Copy the full path of selected entry to the system clipboard.
    115 Requires
    116 .BR wl-copy ", " xclip ", " xsel ", or " pbcopy .
    117 
    118 .SS Multi-Select
    119 .TP
    120 .B space
    121 Toggle multi-select on the current entry (cursor advances).
    122 .TP
    123 .B a
    124 Select all entries / deselect all.
    125 
    126 .SS Bookmarks
    127 .TP
    128 .B b
    129 Bookmark the current directory. Press again to remove it.
    130 .TP
    131 .B B
    132 Open the bookmark picker.
    133 Use j/k to navigate, enter to jump, esc to close.
    134 
    135 .SS Other
    136 .TP
    137 .B !
    138 Drop into
    139 .B $SHELL
    140 in the current directory. Type
    141 .I exit
    142 to return to sfm.
    143 .TP
    144 .B ?
    145 Show the keyboard shortcuts help overlay.
    146 .TP
    147 .B q
    148 Quit sfm.
    149 
    150 .SH PREVIEW PANE
    151 When the preview pane is enabled with
    152 .BR P ,
    153 the terminal is split into a left pane (file list) and a right pane
    154 (preview). The preview shows:
    155 .IP \(bu 2
    156 .B Text files \-
    157 file contents displayed line by line.
    158 .IP \(bu 2
    159 .B Directories \-
    160 directory contents (subdirectories first, then files).
    161 .IP \(bu 2
    162 .B Symlinks \-
    163 the link target path.
    164 .IP \(bu 2
    165 .B Binary files \-
    166 file size.
    167 
    168 .SH CUSTOM OPENER
    169 .B sfm
    170 checks for a user-defined opener script at:
    171 .PP
    172 .I ~/.config/sfm/opener
    173 .PP
    174 If the file exists and is executable, sfm passes the selected file path
    175 to it as the first argument instead of using the built-in smart opener.
    176 .PP
    177 Example opener script:
    178 .PP
    179 .nf
    180 #!/bin/sh
    181 case "$1" in
    182     *.jpg|*.jpeg) imv "$1" ;;
    183     *.mp4)        mpv "$1" ;;
    184     *.html|*.pdf) firefox "$1" ;;
    185     *)            echo "no program set for this file type" ;;
    186 esac
    187 .fi
    188 .PP
    189 If the opener script does not exist, sfm falls back to its built-in
    190 smart opener which detects file types by extension and MIME type.
    191 
    192 .SH SMART FILE OPENER
    193 When no custom opener is configured, sfm opens files using the first
    194 available program for each file type:
    195 .TP
    196 .B Text / code
    197 $EDITOR or vi.
    198 .TP
    199 .B Images
    200 imv, feh, sxiv, eog, gimp.
    201 .TP
    202 .B Video
    203 mpv, vlc, mplayer, totem.
    204 .TP
    205 .B Audio
    206 mpv, vlc, cmus, mocp.
    207 .TP
    208 .B PDF
    209 zathura, evince, okular, mupdf.
    210 .TP
    211 .B Office documents
    212 libreoffice.
    213 .TP
    214 .B Archives
    215 atool or bsdtar (lists contents in pager).
    216 .PP
    217 Falls back to xdg-open, open (macOS), or $EDITOR.
    218 
    219 .SH FILE COLOURS
    220 .TP
    221 .B Green bold
    222 Directories.
    223 .TP
    224 .B Red bold
    225 Executables and broken symlinks.
    226 .TP
    227 .B Magenta
    228 Images.
    229 .TP
    230 .B Magenta bold
    231 Video files and valid symlinks.
    232 .TP
    233 .B Cyan bold
    234 Audio files.
    235 .TP
    236 .B Red
    237 Archives (zip, tar, gz, etc.).
    238 .TP
    239 .B Yellow
    240 Documents (pdf, docx, etc.).
    241 .TP
    242 .B Green
    243 Code and scripts (py, sh, rs, etc.).
    244 .TP
    245 .B Cyan
    246 Config and data files (json, yaml, etc.).
    247 .TP
    248 .B White
    249 Text, markdown, and all other files.
    250 
    251 .SH STATUS BAR INDICATORS
    252 .TP
    253 .B [hidden]
    254 Hidden (dot) files are currently visible.
    255 .TP
    256 .B [sort:size] or [sort:date]
    257 Active sort mode. Not shown when sorting by name (default).
    258 .TP
    259 .B [copy] or [cut]
    260 A file is stored in the clipboard.
    261 .TP
    262 .B [sel:N]
    263 N items are currently multi-selected.
    264 .TP
    265 .B [details]
    266 Size/date detail column is visible.
    267 
    268 .SH TRASH
    269 Files deleted with
    270 .B u
    271 are moved to:
    272 .PP
    273 .I ~/.local/share/sfm-trash/
    274 .PP
    275 Files are prefixed with a timestamp in the format
    276 .IR YYYYMMDD_HHMMSS_filename .
    277 Use
    278 .B U
    279 to browse the trash directory. To restore a file, rename it with
    280 .B r
    281 to remove the timestamp prefix, then cut with
    282 .B x
    283 and paste with
    284 .B p
    285 to the desired location.
    286 
    287 .SH FILES
    288 .TP
    289 .I ~/.config/sfm/bookmarks
    290 Saved bookmarks, one directory path per line.
    291 .TP
    292 .I ~/.config/sfm/opener
    293 Custom file opener script (optional, must be executable).
    294 .TP
    295 .I ~/.local/share/sfm-trash/
    296 Directory where trashed files are stored.
    297 
    298 .SH ENVIRONMENT
    299 .TP
    300 .B EDITOR
    301 Editor used to open text files when no custom opener is set.
    302 .TP
    303 .B SHELL
    304 Shell used when dropping to the terminal with
    305 .BR ! .
    306 .TP
    307 .B PAGER
    308 Pager used when listing archive contents.
    309 .TP
    310 .B XDG_CONFIG_HOME
    311 Base directory for sfm config files. Defaults to
    312 .IR ~/.config .
    313 .TP
    314 .B XDG_DATA_HOME
    315 Base directory for sfm data files (trash). Defaults to
    316 .IR ~/.local/share .
    317 
    318 .SH EXAMPLES
    319 Open sfm in the current directory:
    320 .PP
    321 .nf
    322 sfm
    323 .fi
    324 .PP
    325 Open sfm at a specific path:
    326 .PP
    327 .nf
    328 sfm /mnt/data
    329 .fi
    330 .PP
    331 Use sfm as a cd wrapper (add to shell rc):
    332 .PP
    333 .nf
    334 s() { cd "$(sfm)"; }
    335 .fi
    336 
    337 .SH AUTHORS
    338 Built interactively with Claude (Anthropic).
    339 
    340 .SH SEE ALSO
    341 .BR ls (1),
    342 .BR mv (1),
    343 .BR cp (1),
    344 .BR rm (1),
    345 .BR vi (1)