LinuxCommandLibrary

fasd

Navigate to recent and frequent files/directories

SYNOPSIS

fasd [OPTIONS] [FILES...]
z [DIR_PATTERNS...]
a [FILE_PATTERNS...]
s [FILE_PATTERNS...]
d [DIR_PATTERNS...]
f [FILE_PATTERNS...]

PARAMETERS

-s, --stat
    Lists entries along with their calculated frecent scores.

-e, --exec PROGRAM
    Executes the specified PROGRAM for each matched file.

-a, --all
    Displays all tracked files and directories in the database.

-d, --directories
    Restricts fuzzy search and listing to directories only.

-f, --files
    Restricts fuzzy search and listing to files only.

-l, --list
    Lists entries non-interactively, typically sorted by score.

-r, --remove
    Removes specified entries from the fasd database.

-i, --interactive
    Presents results in an interactive menu for selection.

-I, --init=SHELL
    Prints the shell-specific initialization script for setup.

DESCRIPTION

fasd is a command-line productivity tool that integrates with your shell to provide quick access to frequently and recently used files and directories. It automatically learns your usage patterns by tracking every directory change (via cd) and file access (via commands like ls, vim, less, etc.). This data is then used to assign a "frecent" score (a combination of frequency and recency).

The core functionality revolves around fuzzy matching. Users can type a partial name or a pattern, and fasd will locate the most relevant file or directory based on its frecent score. This significantly reduces the need for long cd commands or extensive path typing, making navigation and file access much faster and more intuitive.

CAVEATS

Requires shell integration (e.g., sourcing an init script in .bashrc or .zshrc) to function correctly. The database can grow large over time, though it's typically managed automatically. Fuzzy matching can sometimes lead to unexpected results if patterns are too broad.

SHELL INTEGRATION

fasd's primary power comes from its seamless integration with popular shells like Bash, Zsh, and Fish. This is achieved by sourcing a shell-specific initialization script (e.g., using fasd --init bash >> ~/.bashrc). This script sets up command aliases (like z, a, s, d, f) and a shell function that hooks into commands like cd to automatically update the frecent database, ensuring accurate tracking of your activity.

FRECENT SCORING ALGORITHM

fasd uses a "frecent" (frequency + recency) scoring algorithm to rank files and directories. The score of an entry increases each time it's accessed and decays over time. This ensures that recently and frequently used items receive higher priority, making them more likely to be selected during fuzzy searches. Users can configure the decay rates and other scoring parameters to fine-tune its behavior.

HISTORY

fasd was created by clvv (Chuan-Zhi Li) and first released around 2011. It was designed as a more comprehensive and flexible alternative to existing directory-jumping tools like the original 'z' script. The name 'fasd' is an acronym for "Files And Sirectories" or perhaps a mnemonic for its common aliases (f, a, s, d, z). Its development has focused on robust shell integration, configurable scoring algorithms, and a wide range of options for searching and interacting with tracked paths.

SEE ALSO

autojump(1), z(1), cd(1), ls(1)

Copied to clipboard