A long time ago I created a script for moving up directories very quickly in the command line using the command up
. You can find usage notes here.
It's a very simple script with just 8 lines of source code, as follows:
if [ -z "$1" ]; then
cd ..
else
for i in `seq 1 $1`;
do
cd ..
done
fi
I've never personally had any problems with it since I made it and started using it myself — but are there any accidental or malicious inputs (particularly with the blind injection of $1
) that might cause this to do something bad that I'm not aware of?
Given that the up
command isn't used for anything in any command line I'm aware of, I'd like to promote more widespread usage of this script file so that people can type up
instead of cd ..
all the time, saving three keystrokes (or more if they want to move up more directories) for a very common operation.
..
. Also,...
,....
,.....
, ... \$\endgroup\$bash
. :P \$\endgroup\$alias f='cd ..;';alias ff='cd ..;cd ..;'alias fff='cd ..;cd ..;cd ..;';alias ffff='cd ..;cd ..;cd ..;cd ..;'; alias fffff='cd ..;cd ..;cd ..';cd ..;cd ..;
inbashrc
because there's only so many times you'd want to go up and the "f" key is easily accessible. Just a matter of typing "f" a few times and then hit enter instead of typeup 5
. The "f" stands for "fall" because from childhood, I consideredcd dirName
to be "climbing" directories andcd ..
to be falling from a climbed directory. \$\endgroup\$cd ../..
forff
? You iterated them independently by hand. \$\endgroup\$cd
to take me home. Since all the files I own and work on are within there. And usually getting back to working files are less than four or five tab-competes deep. Though more commonlycd ~/where/ever/
. [Just speaking generally about my personal cd usage.] \$\endgroup\$