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.
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:
# find assumes email files start with a number 1-9
# sed joins the lines starting with " " to the previous line
# gawk print the received and from lines
# sort according to the second field (received+from)
# uniq print the duplicated filename
# a message is viewed as duplicate if it is received at the same time as another message, and from the same person.
The command was intended to be run under cron. If run in a terminal, mutt can be used:
mutt -e "push otD~=xq" -f $folder
Removes all *.swp files underneath the current directory. Replace "*.swp" with your file pattern(s).
Will check if the given module is installed in the @INC. It will print the path and return 0 if found, or 1 otherwise.
Based on script from SharpyWarpy in http://www.linuxquestions.org/questions/linux-general-1/how-to-list-all-installed-perl-modules-216603/
Just added maxdepth
This command is adapted from http://otomaton.wordpress.com/2012/12/26/find-broken-symbolic-links/
don't work when the link is a loop, an error message is printed.
A lot of files in one dir is not so cool for filesystem.
Old Sys5 system and SUN computers don't have the -H option. Adding /dev/null forces grep to use the multi-file output and report the file name.
find . = will set up your recursive search. You can narrow your search to certain file by adding -name "*.ext" or limit buy using the same but add prune like -name "*.ext" -prune
xargs =sets it up like a command line for each file find finds and will invoke the next command which is perl.
perl = invoke perl
-p sets up a while loop
-i in place and the .bak will create a backup file like filename.ext.bak
-e execute the following....
's/ / /;' your basic substitute and replace.
find files recursively from the current directory, and list the extensions of files uniquely
Assumes you've cd'd to the folder in which all your git repos reside; you could run it from ~ without -maxdepth, although that might make find take quite a while longer.
If you have several processor cores, but not that much ram, you might want to run
git config --global pack.threads 1
first, since gc-ing can eat lots of ram.