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.
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:
The large context number (-C 1000) is a bit of a hack, but in most of my use cases, it makes sure I'll see the whole log output.
I needed to get a feel for how "old" different websites were, based on their directories.
Discover host and url of media files (ex. flv, mp4, m4v..).
It locate the urls of audio and video files so that they can be recorded.
Set field separator char from command line.
Prints first, second and lsat columns.
Have you ever wondered what the hell was dd command doing? well, there you have it... notice the -USR1 signal :)...
# newline to space; the whack before dollar-underbar is required
alias nl2space="perl -ne 'push @F, \$_; END { chomp @F; print join(qq{ }, @F) , qq{\n};}' "
# newline to comma; the whack before dollar-underbar is required
alias nl2,="perl -ne 'push @F, \$_; END { chomp @F; print join(qq{,}, @F) , qq{\n};}' "
PROMPT> cat /tmp/foo
foo-001
foo-002
foo-003
foo-004
foo-005
foo-006
foo-007
foo-008
foo-009
foo-010
# 'tr' does not give a newline after it run. Makes a messy commandline.
PROMPT> cat /tmp/foo|tr "\n" ' '
foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010 $PROMPT> tr "\n" ' ' /tmp/foo
# 'tr' does not take arguements
PROMPT> tr "\n" ' ' /tmp/foo
tr: extra operand `/tmp/foo'
Try `tr --help' for more information.
# 'nl2space' is a filter and takes arguements, adds a newline after it runs.
PROMPT> cat /tmp/foo| nl2space
foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010
PROMPT> nl2space /tmp/foo
foo-001 foo-002 foo-003 foo-004 foo-005 foo-006 foo-007 foo-008 foo-009 foo-010
xargs deals badly with special characters (such as space, ' and "). To see the problem try this:
touch important_file
touch 'not important_file'
ls not* | xargs rm
Parallel https://savannah.nongnu.org/projects/parallel/ does not have this problem.
-l for long list, -r for recursive, -a for display of hidden files, and -t for modification date
do it, disown it and exit without time for a mess
sudo when you mean it
ps aux | grep $USER
exit
The command will help to print the location of the pattern. Above command will print all the files which contain variable "$foo" along with line containing that pattern.
Specify pattern after "grep"
All folders, human-readable, no subfolder, with a total. Even shorter.