GithubHelp home page GithubHelp logo

anthrax3 / bd Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vigneshwaranr/bd

0.0 0.0 0.0 182 KB

Quickly go back to a parent directory in linux instead of typing "cd ../../.." repeatedly

License: MIT License

Shell 100.00%

bd's Introduction

bd

Description

Quickly go back to a specific parent directory in bash instead of typing "cd ../../.." redundantly.


Installation

For Debian/Ubuntu

Packages available here:

https://tracker.debian.org/pkg/bd

https://launchpad.net/ubuntu/+source/bd

For other OS

wget --no-check-certificate -O /usr/local/bin/bd https://raw.github.com/vigneshwaranr/bd/master/bd
chmod +rx /usr/local/bin/bd
echo 'alias bd=". bd -si"' >> ~/.bashrc
source ~/.bashrc

# If you need autocomplete support, follow these two steps
wget -O /etc/bash_completion.d/bd https://raw.github.com/vigneshwaranr/bd/master/bash_completion.d/bd
source /etc/bash_completion.d/bd

To enable case-sensitive directory name matching, use -s instead of -si in the alias.


How to use:

If you are in this path /home/user/project/src/org/main/site/utils/file/reader/whatever and you want to go to site directory quickly,

then just type: bd site

In fact, You can simply type bd <starting few letters> like bd s or bd si

If there are more than one directories with same name up in the hierarchy, bd will take you to the closest. (Not considering the immediate parent.)


Other uses:

Using bd within backticks (`bd <letter(s)>`) prints out the path without changing the current directory.

You can take advantage of that by combining `bd <letter(s)>` with other commands such as ls, ln, echo, zip, tar etc..

Example:

  1. If you just want to list the contents of a parent directory, without going there, then you can use: ls `bd p` in the given example, it will list the contents of /home/user/project/

  2. If you want to execute a file somewhere in a parent directory, `bd p`/build.sh will execute /home/user/project/build.sh while not changing the current directory.

  3. If you reside in /home/user/project/src/org/main/site/utils/file/reader/whatever and want to change to /home/user/project/test, then try cd `bd p`/test


Screenshot: bd screenshot


Thanks:


See also:

bd's People

Contributors

cqr avatar janosgyerik avatar jaysh avatar jophinep avatar peterwvj avatar riklund avatar rmhsilva avatar vigneshwaranr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.