commandlinefu.com is the place to record those command-line gems that you return to again and again.
Delete that bloated snippets file you've been using and share your personal repository with the world. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.
If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/
You can sign-in using OpenID credentials, or register a traditional username and password.
First-time OpenID users will be automatically assigned a username which can be changed after signing in.
Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.
» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10
Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):
Subscribe to the feed for:
There is 1 alternative - vote for the best!
This is like `cd -` but doesn't echo the new directory name, which is preferable (to me) for an alias, e.g.
alias cdo="cd $OLDPWD"
if you cd into a directory then cd into another directory somewhere else then you run the cd - command you will go to the previous directory you was in!! To go back to the other directory just run it again. So if you are working in 2 different directories then this is the perfect command for you.
If you can do better, submit your command here.
You must be signed in to comment.
cd ./-
if you want to change to a dir named '-'
if you like this also look into pushd/popd. it's in the bash man page i think.
pushd/popd are cool but a bit obscure ... "cd -" is straightforward !
always used pushd/popd for this till now.. but this is awesome =)
comes in handy :)
Wow! Using Unix/Linux for 18 years, and only TODAY found this bit of info about so very common command - cd ! Amazing!
why not just "cd .." ???
I've got to remember that one. "cd .." doesn't work for that if the last cd command was "cd ~/foo" rather than "cd bar".
"cd .." goes to the previous directory in the tree, "cd -" goes to the previous _working_ directory.
how about "cd $OLDPWD" ? need to just type in "cd $OL" and tab. bash will take care of the rest :)
Oh my god, I have been flubbing with pushd/popd (only work if you know ahead of time) for .. decades. I didn't even know this existed. Damn.
Seems ?
cd --? jumps to the ~/ directory?
I was always wondering if something like a "cd history" like this existed. Thanks.
But it only remembers the *last* working dir. Is there no way to use it as a stack? Like with pushd/popd? But more automatic?
I was already thinking about aliasing "cd" to "pushd . && cd", but that seems a bit wonky...
The zsh config "setopt AUTO_PUSHD" automatically pushes to dir stack, and I've aliased "p=popd" so at any point I can type "p" to navigate up my working directory history.