15
ruhe
6y

So after @danacus commented here https://devrant.com/rants/1860006/... about a command called "tp" to teleport from one directory to another, I felt the urge to write myself such tool. This was one of my first pure bash projects and I'm happy to announce that it finally is finished! I really hate self-promotion but since I use this tool in every single bash session and find it very convenient, I decided to share it with y'all. I'd be super glad if you give me your opinion about it!

git clone https://github.com/bitteruhe/tp

Comments
  • 1
  • 1
    @ruhe That's really cool! I might try it out. (or maybe I'll stick with my own zsh config for now)
  • 1
    @Danacus do as you like! Just know that I'm thankful for that idea you gave me a month ago
  • 4
    (I’m new to bash) what’s the diff between cd and tp?
  • 2
    @baeovvulf cd changes the directory. You can use it with absolute and with relative paths.
    Say you are currently in the dir ~/Documents/oof/rab and want to switch to ~/Desktop/foo/bar. What you can do is to call cd like this:

    cd ../../../Desktop/foo/bar

    Or like this:

    cd ~/Desktop/foo/bar

    I created tp because I think that this is too much work to simply switch to the bar-folder. Therefore, my tool allows you to store a short name, called portal, with the corresponding directory.
    In this case, I would create a portal called 'bar' that points to the directory ~/Desktop/foo/bar. This allows me to simply call

    tp bar

    which then teleports me directly to this folder from wherever I currently am located. It comes in handy when you need to switch to a certain folder on a regular basis
  • 2
    @baeovvulf tp is a command we invented. You can use it to quickly cd to a directory that you often use, without having to write the full path.

    Edit: what ruhe just said while I was typing
  • 1
    How does it work out what the correct path would be if I have several /bar folders under /foo/bar /cup/bar /trog/bar etc?

    Nevermind I see its git was linked ...
  • 4
    @ruhe @Danacus ah! Cool! I’m trying to use bash as much as possible to learn it... I would totally use this!
  • 4
    Sooo
    $bar=~/path/bar
    cd $bar

    ?
  • 1
    @mundo03 Good point actually!
  • 1
    @mundo03 Good point indeed!
    Still, i prefer
    $ tp --add bar ~/path/bar
    $ tp bar
  • 1
    @ruhe I open as many terminal tabs as I need, I normally stay in 2 or 3
    But I do get the point of tp which reminds me of toilet papet
  • 0
    tp sounds like fasd... No?
  • 1
    Or alias src=~/projects/src
  • 0
    just discovered the cd - command

    so.
    cd foo
    cd bar
    cd - // changes to foo
    cd - // changes to bar
    cd - // changes to foo again, ad so on.

    this would be enough for me ... if I don't open a tab for every directory I need anyway.

    would it be enough for you?
  • 1
    @benj sounds like toilette paper
Add Comment