Most active commenters

    ←back to thread

    756 points speckx | 12 comments | | HN request time: 0.428s | source | bottom
    1. revicon ◴[] No.45674313[source]
    I have a bunch of little scripts and aliases I've written over the years, but none are used more than these...

    alias ..='cd ..'

    alias ...='cd ../..'

    alias ....='cd ../../..'

    alias .....='cd ../../../..'

    alias ......='cd ../../../../..'

    alias .......='cd ../../../../../..'

    replies(6): >>45674378 #>>45674420 #>>45674599 #>>45675353 #>>45676254 #>>45678784 #
    2. Bishonen88 ◴[] No.45674378[source]
    up() { local d="" for ((i=1; i<=$1; i++)); do d="../$d" done cd "$d" }

    up 2, up 3 etc.

    3. vunderba ◴[] No.45674420[source]
    Does zsh support this out-of-the-box? Because I definitely never had to setup any of these kinds of aliases but have been using this shorthand dot notation for years.
    replies(2): >>45674855 #>>45679296 #
    4. tacone ◴[] No.45674599[source]
    I have setup a shortcut: alt+. to run cd.., it's pretty cool.

    I also aliased - to run cd -

    replies(1): >>45675580 #
    5. machomaster ◴[] No.45674855[source]
    Yes it does.
    replies(1): >>45675304 #
    6. Noumenon72 ◴[] No.45675304{3}[source]
    Not on my Mac.

        zsh: permission denied: ..
        zsh: command not found: ...
    7. cosmos0072 ◴[] No.45675353[source]
    I need this *so* often that I programmed my shell to execute 'cd ..' every time I press KP/ i.e. '/' on the keypad, without having to hit Return.

    Other single-key bindings I use often are:

    KP* executes 'ls'

    KP- executes 'cd -'

    KP+ executes 'make -j `nproc`'

    replies(1): >>45678496 #
    8. fragmede ◴[] No.45675580[source]
    but alt-. in bash is used for pasting the last argument to the previous command into the current one.
    9. pfg_ ◴[] No.45676254[source]
    fish lets you cd to a folder without 'cd' although you still need the slashes. I use it all the time.

        c $> pwd
        /a/b/c
        c $> dir1
        dir1 $> ..
        c $> ../..
        / $>
    10. sudahtigabulan ◴[] No.45678496[source]
    How? Readline macros?
    11. ◴[] No.45678784[source]
    12. soraminazuki ◴[] No.45679296[source]
    It's an oh-my-zsh thing.