Convert Figma logo to code with AI

dylanaraps logofff

šŸ“ A simple file manager written in bash.

4,076
172
4,076
60

Top Related Projects

63,665

:cherry_blossom: A command-line fuzzy finder

33,285

A simple, fast and user-friendly alternative to 'find'

7,602

Terminal file manager

18,863

nĀ³ The unorthodox terminal file manager

15,354

A VIM-inspired filemanager for the console

2,699

Vifm is a file manager with curses interface, which provides Vim-like environment for managing objects within file systems, extended with some useful ideas from mutt.

Quick Overview

fff (Fast File-Manager) is a minimalist file manager written in bash. It's designed to be fast, simple, and portable, offering a command-line interface for navigating and managing files and directories.

Pros

  • Lightweight and fast, with minimal dependencies
  • Highly customizable through environment variables
  • Cross-platform compatibility (Linux, macOS, BSD)
  • Supports file operations like copy, move, delete, and rename

Cons

  • Limited graphical interface, which may be challenging for users accustomed to GUI file managers
  • Lacks some advanced features found in more comprehensive file managers
  • Requires basic command-line knowledge to use effectively
  • May not be suitable for complex file management tasks

Code Examples

# Navigate to a directory
f /path/to/directory

# Copy a file
f -c file.txt /path/to/destination/

# Move a file
f -m file.txt /path/to/destination/
# Delete a file
f -d file.txt

# Rename a file
f -r oldname.txt newname.txt
# Search for files
f -s "search term"

# Show hidden files
f -h

Getting Started

To install fff, clone the repository and add the script to your PATH:

git clone https://github.com/dylanaraps/fff.git
cd fff
sudo make install

# Or, if you don't have make:
sudo cp fff /usr/local/bin/fff
sudo cp fff.1 /usr/local/share/man/man1

# Run fff
fff

To customize fff, you can set environment variables in your shell configuration file (e.g., .bashrc or .zshrc):

export FFF_HIDDEN=1  # Show hidden files by default
export FFF_FAV1=~/Documents  # Set favorite directory
export FFF_MARK_CMD="echo {} >> ~/.fff_marked"  # Custom mark command

Competitor Comparisons

63,665

:cherry_blossom: A command-line fuzzy finder

Pros of fzf

  • More feature-rich and versatile, supporting various input sources and customization options
  • Faster performance for large datasets due to its efficient fuzzy search algorithm
  • Wider ecosystem with integrations for many popular tools and shells

Cons of fzf

  • Larger codebase and more complex setup compared to fff's simplicity
  • Requires external dependencies (Go runtime) for installation from source

Code comparison

fff (simple file selection):

#!/usr/bin/env bash
[ -z "$1" ] && cd || cd "$1"
while :; do
    printf '%s\n' "${PWD##*/}"
    ls
    read -r input
    [ "$input" = "q" ] && exit
    cd "$input" 2>/dev/null || :
done

fzf (basic fuzzy finder):

#!/usr/bin/env bash
fzf --multi --reverse --border \
    --preview 'cat {}' \
    --bind 'ctrl-/:change-preview-window(down|hidden|)' \
    < <(find . -type f)

Summary

fff is a minimalist file manager written in Bash, focusing on simplicity and portability. fzf is a more powerful and flexible fuzzy finder with broader applications beyond file management. While fff excels in its lightweight nature and ease of use, fzf offers advanced features and better performance for complex search tasks.

33,285

A simple, fast and user-friendly alternative to 'find'

Pros of fd

  • Written in Rust, offering better performance and memory safety
  • Supports colored output and parallel command execution
  • More extensive command-line options for advanced searching

Cons of fd

  • Larger binary size due to Rust compilation
  • May require installation of Rust toolchain for building from source
  • Slightly more complex syntax for some advanced features

Code Comparison

fd:

let regex = RegexBuilder::new(&pattern)
    .case_insensitive(case_sensitive)
    .build()
    .unwrap();

fff:

search() {
    find "$PWD" -iname "*$1*" 2>/dev/null
}

Summary

fd is a more feature-rich and performant alternative to fff, offering advanced search capabilities and parallel execution. However, fff is a simpler, shell-based solution that may be easier to integrate into existing scripts or systems without additional dependencies. The choice between the two depends on the specific use case and performance requirements.

7,602

Terminal file manager

Pros of lf

  • Written in Go, offering better performance and cross-platform compatibility
  • More feature-rich, including file previews, bookmarks, and customizable keybindings
  • Active development with regular updates and improvements

Cons of lf

  • Larger binary size due to being written in Go
  • Steeper learning curve with more complex configuration options
  • May be considered "overkill" for users seeking a minimal file manager

Code Comparison

fff (Shell):

#!/usr/bin/env bash
# A simple file manager written in bash.

[[ $1 == -v ]] && {
    printf '%s\n' "fff 2.2"
    exit
}

lf (Go):

package main

import (
    "log"
    "os"

    "github.com/gokcehan/lf/commands"
    "github.com/gokcehan/lf/ui"
)

func main() {
    if err := ui.Start(); err != nil {
        log.Fatal(err)
    }
}

The code snippets highlight the difference in implementation languages and complexity between the two projects. fff is a simple bash script, while lf is a more complex Go application with multiple packages and a structured codebase.

18,863

nĀ³ The unorthodox terminal file manager

Pros of nnn

  • More feature-rich, with advanced functionality like batch renaming and file previews
  • Actively maintained with frequent updates and improvements
  • Supports plugins for extended functionality

Cons of nnn

  • Larger codebase and more complex, potentially harder to customize
  • Steeper learning curve due to more features and options
  • Higher system resource usage compared to fff

Code Comparison

nnn (C):

static int
nnn(char *pwd, char *ipath, char *session, char *pkey, char *picker, char *blk, char *icns, char *cpi, char *cpf)
{
    char *path = NULL;
    char *lastdir = NULL;
    char *lastname = NULL;
    size_t len;

fff (Shell):

fff() {
    # Setup options.
    shopt -s nullglob
    shopt -s nocaseglob

    # Setup TUI.
    setup_terminal
    get_term_size

nnn is a more comprehensive file manager with a wider range of features, while fff is a lightweight and minimalist alternative. nnn is written in C, offering better performance for complex operations, while fff is a shell script, making it easier to modify but potentially slower for large directories. nnn's active development and plugin support make it more versatile, but fff's simplicity may be preferable for users seeking a basic file manager with a smaller footprint.

15,354

A VIM-inspired filemanager for the console

Pros of ranger

  • More feature-rich and customizable file manager
  • Supports image previews and file highlighting
  • Has a larger community and ecosystem of plugins

Cons of ranger

  • Heavier and slower to start up compared to fff
  • More complex to configure and use for basic file operations
  • Requires Python and additional dependencies

Code comparison

ranger:

import os
from ranger.core.loader import CommandLoader

def execute_file(self, files, **kw):
    # Complex file execution logic
    # ...

fff:

open() {
    case "$1" in
        *.jpg|*.png|*.gif) image_viewer "$1" ;;
        *.mp4|*.mkv|*.avi) video_player "$1" ;;
        *) "${EDITOR:-vi}" "$1" ;;
    esac
}

Summary

ranger is a more powerful and feature-rich file manager with a larger ecosystem, while fff is a lightweight and fast alternative written in Bash. ranger offers more customization options and advanced features like image previews, but it comes at the cost of increased complexity and slower startup times. fff, on the other hand, provides a simpler and faster file management experience with minimal dependencies, making it suitable for users who prefer a more streamlined approach.

2,699

Vifm is a file manager with curses interface, which provides Vim-like environment for managing objects within file systems, extended with some useful ideas from mutt.

Pros of vifm

  • More feature-rich and customizable file manager
  • Supports dual-pane view for easier file operations
  • Has a built-in text viewer and basic text editor

Cons of vifm

  • Steeper learning curve due to its Vim-like interface
  • Requires more system resources compared to fff
  • More complex configuration and setup process

Code Comparison

vifm (configuration example):

" Sample vifmrc
set vicmd=vim
set syscalls
set trash
set history=100
set nofollowlinks
set sortnumbers
set undolevels=100
colorscheme Default

fff (usage example):

# Basic fff usage
fff
# Open fff in a specific directory
fff /path/to/directory
# Use fff with custom options
fff -p /tmp/fff_fifo

Summary

vifm is a more powerful and feature-rich file manager with a Vim-like interface, offering dual-pane view and built-in text viewing/editing capabilities. However, it has a steeper learning curve and requires more resources. fff, on the other hand, is a simpler, lightweight file manager focused on speed and minimal resource usage, making it easier to use but with fewer advanced features.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

fff (Fucking Fast File-Manager)

img

A simple file manager written in bash.

Packaging status

  • It's Fucking Fast Ć°ĀŸĀšĀ€
  • Minimal (only requires bash and coreutils)
  • Smooth Scrolling (using vim keybindings)
  • Works on Linux, BSD, macOS, Haiku etc.
  • Supports LS_COLORS!
  • File Operations (copy, paste, cut, ranger style bulk rename, etc) img
  • Instant as you type search
  • Tab completion for all commands!
  • Automatic CD on exit (see setup)
  • Works as a file picker in vim/neovim (link)!
  • Display images with w3m-img!
  • Supports $CDPATH.

Table of Contents

Dependencies

  • bash 3.2+
  • coreutils
    • File operations.
  • xdg-utils (optional)
    • Program handling (non-text).
    • Not needed on macos and Haiku.
    • Customizable (if not using xdg-open): $FFF_OPENER.

Dependencies for image display

  • w3m-img
  • xdotool for X.
  • fbset for the framebuffer.

Installation

Distros

  • KISS Linux (based): kiss b fff
  • FreeBSD: pkg install fff
  • Haiku: pkgman install fff
  • macOS: brew install fff
  • Nix: nix-env -iA fff
  • Void Linux: xbps-install -S fff
  • Arch Linux: pacman -S fff

Manual

  1. Download fff.
  2. Change working directory to fff.
    • cd fff
  3. Run make install inside the script directory to install the script.
    • El Capitan: make PREFIX=/usr/local install
    • Haiku: make PREFIX="$(finddir B_USER_NONPACKAGED_DIRECTORY)" MANDIR='$(PREFIX)/documentation/man' DOCDIR='$(PREFIX)/documentation/fff' install
    • OpenIndiana: gmake install
    • MinGW/MSys: make -i install
    • NOTE: You may have to run this as root.

NOTE: fff can be uninstalled easily using make uninstall. This removes all of files from your system.

CD on Exit

Bash and Zsh

# Add this to your .bashrc, .zshrc or equivalent.
# Run 'fff' with 'f' or whatever you decide to name the function.
f() {
    fff "$@"
    cd "$(cat "${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d")"
}

Fish

# Add this to you config.fish or equivalent.
# Fish don't support recursive calls so use f function
function f
    fff $argv
    set -q XDG_CACHE_HOME; or set XDG_CACHE_HOME $HOME/.cache
    cd (cat $XDG_CACHE_HOME/fff/.fff_d)
end

Usage

j: scroll down
k: scroll up
h: go to parent dir
l: go to child dir

enter: go to child dir
backspace: go to parent dir

-: Go to previous dir.

g: go to top
G: go to bottom

:: go to a directory by typing.

.: toggle hidden files
/: search
t: go to trash
~: go to home
e: refresh current dir
!: open shell in current dir

x: view file/dir attributes
i: display image with w3m-img

down:  scroll down
up:    scroll up
left:  go to parent dir
right: go to child dir

f: new file
n: new dir
r: rename
X: toggle executable

y: mark copy
m: mark move
d: mark trash (~/.local/share/fff/trash/)
s: mark symbolic link
b: mark bulk rename

Y: mark all for copy
M: mark all for move
D: mark all for trash (~/.local/share/fff/trash/)
S: mark all for symbolic link
B: mark all for bulk rename

p: execute paste/move/delete/bulk_rename
c: clear file selections

[1-9]: favourites/bookmarks (see customization)

q: exit with 'cd' (if enabled).
Ctrl+C: exit without 'cd'.

Customization

# Show/Hide hidden files on open.
# (Off by default)
export FFF_HIDDEN=1

# Use LS_COLORS to color fff.
# (On by default if available)
# (Ignores FFF_COL1)
export FFF_LS_COLORS=1

# Directory color [0-9]
export FFF_COL1=2

# Status background color [0-9]
export FFF_COL2=7

# Selection color [0-9] (copied/moved files)
export FFF_COL3=6

# Cursor color [0-9]
export FFF_COL4=1

# Status foreground color [0-9]
export FFF_COL5=0

# Text Editor
export EDITOR="vim"

# File Opener
export FFF_OPENER="xdg-open"

# File Attributes Command
export FFF_STAT_CMD="stat"

# Enable or disable CD on exit.
# (On by default)
export FFF_CD_ON_EXIT=0

# CD on exit helper file
# Default: '${XDG_CACHE_HOME}/fff/fff.d'
#          If not using XDG, '${HOME}/.cache/fff/fff.d' is used.
export FFF_CD_FILE=~/.fff_d

# Trash Directory
# Default: '${XDG_DATA_HOME}/fff/trash'
#          If not using XDG, '${HOME}/.local/share/fff/trash' is used.
export FFF_TRASH=~/.local/share/fff/trash

# Trash Command
# Default: 'mv'
#          Define a custom program to use to trash files.
#          The program will be passed the list of selected files
#          and directories.
export FFF_TRASH_CMD="mv"

# Favourites (Bookmarks) (keys 1-9) (dir or file)
export FFF_FAV1=~/projects
export FFF_FAV2=~/.bashrc
export FFF_FAV3=~/Pictures/Wallpapers/
export FFF_FAV4=/usr/share
export FFF_FAV5=/
export FFF_FAV6=
export FFF_FAV7=
export FFF_FAV8=
export FFF_FAV9=

# w3m-img offsets.
export FFF_W3M_XOFFSET=0
export FFF_W3M_YOFFSET=0

# File format.
# Customize the item string.
# Format ('%f' is the current file): "str%fstr"
# Example (Add a tab before files): FFF_FILE_FORMAT="\t%f"
export FFF_FILE_FORMAT="%f"

# Mark format.
# Customize the marked item string.
# Format ('%f' is the current file): "str%fstr"
# Example (Add a ' >' before files): FFF_MARK_FORMAT="> %f"
export FFF_MARK_FORMAT=" %f*"

Customizing the keybindings.

Keybindings

This is the list of full keybindings along with their default values. You only need to modify the keybindings that you'd like to change from the default. fff will run perfectly fine without any of these defined.

### Moving around.

# Go to child directory.
export FFF_KEY_CHILD1="l"
export FFF_KEY_CHILD2=$'\e[C' # Right Arrow
export FFF_KEY_CHILD3=""      # Enter / Return

# Go to parent directory.
export FFF_KEY_PARENT1="h"
export FFF_KEY_PARENT2=$'\e[D' # Left Arrow
export FFF_KEY_PARENT3=$'\177' # Backspace
export FFF_KEY_PARENT4=$'\b'   # Backspace (Older terminals)

# Go to previous directory.
export FFF_KEY_PREVIOUS="-"

# Search.
export FFF_KEY_SEARCH="/"

# Spawn a shell.
export FFF_KEY_SHELL="!"

# Scroll down.
export FFF_KEY_SCROLL_DOWN1="j"
export FFF_KEY_SCROLL_DOWN2=$'\e[B' # Down Arrow

# Scroll up.
export FFF_KEY_SCROLL_UP1="k"
export FFF_KEY_SCROLL_UP2=$'\e[A'   # Up Arrow

# Go to top and bottom.
export FFF_KEY_TO_TOP="g"
export FFF_KEY_TO_BOTTOM="G"

# Go to dirs.
export FFF_KEY_GO_DIR=":"
export FFF_KEY_GO_HOME="~"
export FFF_KEY_GO_TRASH="t"
export FFF_KEY_REFRESH="e"

### File operations.

export FFF_KEY_YANK="y"
export FFF_KEY_MOVE="m"
export FFF_KEY_TRASH="d"
export FFF_KEY_LINK="s"
export FFF_KEY_BULK_RENAME="b"

export FFF_KEY_YANK_ALL="Y"
export FFF_KEY_MOVE_ALL="M"
export FFF_KEY_TRASH_ALL="D"
export FFF_KEY_LINK_ALL="S"
export FFF_KEY_BULK_RENAME_ALL="B"

export FFF_KEY_PASTE="p"
export FFF_KEY_CLEAR="c"

export FFF_KEY_RENAME="r"
export FFF_KEY_MKDIR="n"
export FFF_KEY_MKFILE="f"
export FFF_KEY_IMAGE="i" # display image with w3m-img

### Miscellaneous

# Show file attributes.
export FFF_KEY_ATTRIBUTES="x"

# Toggle executable flag.
export FFF_KEY_EXECUTABLE="X"

# Toggle hidden files.
export FFF_KEY_HIDDEN="."

Disabling keybindings.

You can't unset keybindings by making their value ''. What you need to do is change their value to off.

Example:

# KEY_GO_TRASH was bound to 't', now its unset.
export FFF_KEY_GO_TRASH="off"

# KEY_MKFILE is now set to 't' and its original
# keybinding is also unset 'f'.
export FFF_KEY_MKFILE="t"

Dealing with conflicting keybindings.

When rebinding a key in fff make sure you don't have two bindings with the same value. You can avoid this by setting the other conflicting key-binding to something else or by changing its value to off.

How to figure out special keys.

Below is a tiny script I've written which will tell you the exact value to use. It automates the deciphering of special key escape sequences to the exact value fff needs. Save this to a file and run it. Give it a key-press and it'll spit out the exact value needed.

#!/usr/bin/env bash
# Output the key-binding values for 'fff'.
key() {
    case "$1" in
        # Backspace.
        $'\b'|$'\177')
            printf '%s\n' "key: \$'\\b' or \$'\\177'"
        ;;

        # Escape Sequences.
        $'\e')
            read -rsn 2
            printf '%s %q\n' "key:" "${1}${REPLY}"
        ;;

        # Return / Enter.
        "")
            printf '%s\n' "key: \" \""
        ;;

        # Everything else.
        *)
            printf '%s %q\n' "key:" "$1"
        ;;
    esac
}

read -srn 1 && key "$REPLY"

Using fff in vim/neovim as a file picker

See: fff.vim

Why?

ƂĀÆ\(Ć£ĀƒĀ„)/ƂĀÆ

dont touch my shrug