commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
The biggest advantage of this over the functions is that it is portable.
There is 1 alternative - vote for the best!
How often do you make a directory (or series of directories) and then change into it to do whatever? 99% of the time that is what I do.
This BASH function 'md' will make the directory path then immediately change to the new directory. By using the 'mkdir -p' switch, the intermediate directories are created as well if they do not exist.
I find that I create a directory and then cd into that directory quite often. I found this little function on the internets somewhere and thought I'd share it. Just copy-paste it into you ~/.bash_profile and then `source ~/.bash_profile`.
combines mkdir and cd
added quotes around $_, thanx to flatcap!
# put this in your .bashrc
mkdir $1 && cd $1
If you can do better, submit your command here.
You must be signed in to comment.