Live data from Hacker News

Show HN: Quick Command-line File Completion

pindexis.github.io

11–12 of 12 posts

Re: Show HN: Quick Command-line File Completion

#11
post #5

I always wanted this, typing paths is so annoying. I think the command line got stuck in the last millennium. So much things could be automated there, especially command completion. Why do I have to remember the stupid -xfv parameters for tar or whatever. Computers should be like magic. What could be improved: if I type "nano index." I see some index.js files but not my index.html file from my node project. Ah ok it'…

Just add this to your .[bash/zsh]rc:

  ex ()
  {
    if [ -f $1 ] ; then
        case $1 in
            *.tar.bz2) tar xjf $1 ;;
            *.tar.gz) tar xzf $1 ;;
            *.bz2) bunzip2 $1 ;;
            *.rar) unrar x $1 ;;
            *.gz) gunzip $1 ;;
            *.tar) tar xf $1 ;;
            *.tbz2) tar xjf $1 ;;
            *.tgz) tar xzf $1 ;;
            *.zip) unzip $1 ;;
            *.Z) uncompress $1;;
            *.7z) 7z x $1 ;;
            *) echo "'$1' cannot be extracted via ex()" ;;
       esac
    else
        echo "'$1' is not a valid file"
    fi
}

Re: Show HN: Quick Command-line File Completion

#12

Look into fish shell. It does this and more. Or iterm2 does similar.

iTerm2 does something like that? How/what? I've been using it for years and never heard of that, looks like once again I've been missing out on something incredibly useful for way too long. :)

http://www.iterm2.com/version3.html
Post reply on HN