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:
a() function in bc is for arctangent, available if using -l option included.
I simply find binary notation more straightforward to use than octal in this case.
Obviously it is overkill if you just 600 or 700 all of your files...
Probably more trouble than its worth, but worked for the obscure need.
This is an "argument calculator" funktion. The precision is set to 4 and you can use dot (.) or comma (,) as decimal mark (which is great for german users with a comma on the numpad).
This is a very simple way to input a large number of seconds and get a more useful value in minutes and seconds. Avoids useless use of echo.
Want to run scripts/programs in the system after starting X minute [ For letting the system to free ]? This will give uptime in minute.
Use this to find identify if dirs mostly contain large or small files.
Calculate pi from the infinite series 4/1 - 4/3 + 4/5 - 4/7 + ...
This expansion was formulated by Gottfried Leibniz: http://en.wikipedia.org/wiki/Leibniz_formula_for_pi
I helped rubenmoran create the sum of a sequence of numbers and he replied with a command for the sequence: 1 + 2 -3 + 4 ...
This set me thinking. Transcendental numbers!
seq provides the odd numbers 1, 3, 5
sed turns them into 4/1 4/3 4/5
paste inserts - and +
bc -l does the calculation
Note: 100 million iterations takes quite a while. 1 billion and I run out of memory.
Of course, this command must be executed at a GRID User Interface
lhcb - name of your VO, substitute it with the one you are interested it.
Use bc for decimals...
If you want a sequence that can be plotted, do:
seq 8 | awk '{print "e(" $0 ")" }' | bc -l | awk '{print NR " " $0}'
Other bc functions include s (sine), c (cosine), l (log) and j (bessel). See the man page for details.
This is the answer to the 0th problem from the python challenge < http://www.pythonchallenge.com/ >. Replace sensible-browser with firefox, w3m or whatever.
terms inclosing '()' must be enclosed by "" (soft quotes)
bash variables must be referenced: b $x/$y
ugly bracket checking (balanced, fractions...)
default precision 2
You're behind on your TV catch-up, but how far behind? This command tries to open mplayer against all files in the current dir. If it's a video file it will contain ID_LENGTH, which is summed and output in hours, minutes and seconds.
Someone better at awk could probably reduce this down a lot.
-l auto-selects many more digits (but you can round/truncate in your head, right) plus it loads a few math functions like sin().