Live data from Hacker News

Aren't you tired of using "cd ../"

news.ycombinator.com

1–6 of 6 posts

Aren't you tired of using "cd ../"

#1
As a sysadmin how many times have you typed this sequence? I bet that in my past 20 years... billions. This might be a silly simple thing but never read it before.

Why not:

alias .='cd ../'

and voila from 5 to 1. That is what I call a quick win :-)

Re: Aren't you tired of using "cd ../"

#2
Why not? Because it changes the meaning of '.':

  ~$ echo date > d.sh
  ~$ d.sh
  -bash: d.sh: command not found
  ~$ . d.sh
  06:37:21 EDT 2013
  ~$ alias .='cd ../'
  ~$ . d.sh
  /home$ Is not works!
But another alias with no previous meaning would do well - i use 'up' :)

Re: Aren't you tired of using "cd ../"

#3
post #2

Why not? Because it changes the meaning of '.': ~$ echo date > d.sh ~$ d.sh -bash: d.sh: command not found ~$ . d.sh 06:37:21 EDT 2013 ~$ alias .='cd ../' ~$ . d.sh /home$ Is not works! But another alias with no previous meaning would do well - i use 'up' :)

I use ".." to go up one, and ".. 3" to go up 3. Source: http://alias.sh/cd-number-dirs

Re: Aren't you tired of using "cd ../"

#4
Why the slash? And a lot of Linux distributions already have '..' as the same alias -- as . is already a shortcut for 'source'.

If you really want to optimize this, there's always your .inputrc.

"\e[24~": "cd ..\n"

For lots of terminals, this maps your F12 key to go up a level in the directory hierarchy, no subsequent press of the enter key required.

Re: Aren't you tired of using "cd ../"

#5
post #3
post #2

Why not? Because it changes the meaning of '.': ~$ echo date > d.sh ~$ d.sh -bash: d.sh: command not found ~$ . d.sh 06:37:21 EDT 2013 ~$ alias .='cd ../' ~$ . d.sh /home$ Is not works! But another alias with no previous meaning would do well - i use 'up' :)

I use ".." to go up one, and ".. 3" to go up 3. Source: http://alias.sh/cd-number-dirs

For "longer" jump through the filesystem, 'autojump' does a great job https://github.com/joelthelion/autojump

Re: Aren't you tired of using "cd ../"

#6
post #5
post #3

Earlier quoted context omitted.

I use ".." to go up one, and ".. 3" to go up 3. Source: http://alias.sh/cd-number-dirs

For "longer" jump through the filesystem, 'autojump' does a great job https://github.com/joelthelion/autojump

Great, thank for the advices. I'll take a look at them all!

Cheers

Juan