LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

bd

Navigate to parent directories by name

TLDR

Go back to a parent directory by name (or its first few letters)
$ bd [name]
copy
Case-sensitive match
$ bd -s [name]
copy
Run a command in a parent directory without changing to it
$ ls `bd [name]` 
copy

SYNOPSIS

bd [-si] name

DESCRIPTION

bd (back directory) is a bash utility for quickly navigating to a parent directory by name instead of typing multiple `cd ../../../` commands. It searches upward in the current path for a directory whose name matches (matching on the first few letters is enough).If several ancestors share the same name, bd jumps to the closest one (the immediate parent is not considered a match). It is installed as a shell alias so the directory change persists in your shell:

$ alias bd=". bd -si"
copy

PARAMETERS

-s

Case-sensitive matching (the default alias uses -si for case-insensitive).
-i
Case-insensitive matching (no-op when already the default).

WORKFLOW

$ # Current path: /home/user/projects/myapp/src/components
# Jump up to 'myapp'
bd myapp
# Now in: /home/user/projects/myapp

# Or just the first letters
bd my

# Use a parent path inline without leaving the current directory
cp file.txt `bd projects`
copy

FEATURES

- Prefix matching on parent directory names- Bash completion support (via the bundled completion file)- Closest-match resolution when names repeat in the path

INSTALL

yay -S bd
copy

CAVEATS

Requires installation and an alias in your shell config (the alias sources the script so the `cd` sticks). Only walks upward through the current path, not into sibling trees. Built for bash; separate ports exist for zsh and fish. Not available by default on most systems.

HISTORY

bd was created by Vigneshwaran Raveendran (vigneshwaranr) to simplify navigating up directory trees by name.

SEE ALSO

cd(1), pushd(1), z(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid