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:
Usage:
up N
I did not like two things in the submitted commands and fixed it here:
1) If I do cd - afterwards, I want to go back to the directory I've been before
2) If I call up without argument, I expect to go up one level
It is sad, that I need eval (at least in bash), but I think it's safe here.
eval is required, because in bash brace expansion happens before variable substitution, see http://rosettacode.org/wiki/Repeat_a_string#Using_printf
wipes directory/ "recursively" "w/o confirming" deletion in "quick" mode for "10" passes.
This doesn't require any non-standard programs.
or
tree -ifsF --noreport .|sort -n -k2|grep -v '/$'
(rows presenting directory names become hidden)
This let me find some a set of modifications that were made to a rather large tree of files, where the file-names themselves were not unique (actually: insanely redundant and useless. "1.dat 2.dat ..."). Pruning down to last-branch brough things back to the "project-name" scope, and it's then easy to see which branches of the tree have recently changed, or any other similar search.
Ideally, it should sort the directories by the mtime of the most recent *file* *inside* the directory, but that's probably outside the scope of a (sane...) command line.
Returns the most recently modified file in the current (or specified) directory. You can also get the oldest file, via:
ls -t1 $* | tail-1 ;
You don't need to use "*", it will fail if the working directory has too many fails due parameter extension, you can simply pass the working directory using ".".
You don't need to use "*", it will fail if the working directory has too many fails due parameter extension, you can simply pass the working directory using ".".
Like normal ls, but only lists directories.
Can be used with -l to get more details (ls -lad */)
Usage: jd dir
Requires globstar. To set globstar use:
shopt -s globstar
This command lists all the directories in SEARCHPATH by size, displaying their size in a human readable format.
Deletes capistrano-style release directories (except that there are dashes between the YYYY-MM-DD)
This will recursively add files/directories in SVN.
Usage:
svnradd yourfile
or
svnradd yourdirectory
then:
svn commit
Notice: It might not work properly, and not all files could get added.
Since there is a limit on characters, I couldn't add failure/success notices.
If you want failure/success notices, download Terminal Enhancements (http://tenhancements.tk/ )
It is included on Base Features
Do you have a large library of flv's you have picked up over the years using FlashGot Firefox plugin?
Do you want to be able to convert them to Ogg Theora (video) at once?
Try out this script...
pushd and popd are your friends, but sometimes they're just incompatible with the way one works...
Two shell functions:
bm bookmarkname - "bookmarks" the current directory, just 'cd $BMbookmarkname' to return to it.
forget bookmarkname - unsets the 'bookmarkname' variable. It isn't mandatory, they cease to exist when the session ends.
very handy if you copy or download a/some file(s) and want to know how big it is at the moment