commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
new way to replace text file with dd,faster than head,sed,awk if you do this with big file
Enhancement for the 'busy' command originally posted by busybee : less chars, no escape issue, and most important it exclude small files ( opening a 5 lines file isn't that persuasive I think ;) )
This makes an alias for a command named 'busy'. The 'busy' command opens a random file in /usr/include to a random line with vim.
It does not work without the verbose mode (-v is important)
Not perfect but working (at least on the project i wrote it ;) )
Specify what you want search in var search, then it grep the folder and show one result at a time.
Press enter and then it will show the next result.
It can work bad on result in the firsts lines, and it can be improved to allow to come back.
But in my case (a large project, i was checking if a value wasn't used withouth is corresponding const and the value is "1000" so there was a lot of result ...) it was perfect ;)
Use this to find identify if dirs mostly contain large or small files.
Downloads the entire file, but http servers don't always provide the optional 'Content-Length:' header, and ftp/gopher/dict/etc servers don't provide a filesize header at all.
Replace .py with .rb or .java to get the LOC of that particular filetype. An alternative is http://www.commandlinefu.com/commands/view/2812/make-a-statistic-about-the-lines-of-code
There's nothing particularly novel about this combination of find, grep, and wc, I'm just putting it here in case I want it again.
An advanced possibility to count the lines of code like in #8394
it recursively searches your project's directories and sum the lines of every source [.c or .h]. Then it gives you the total.
Bash function copies a file prefixed with a version number to a subdirectory
Counts the number of new emails in the post office (or wherever mail is set up to check).
The same thing using only Bash built-in's.
For readability I've kept the variables out, but it could me made extremely more compact (and totally unreadable!) by stuffing everything inside the single echo command.
This gives a very rough estimate of how many pages your text files will print on. Assumes 60 lines per page, and does not take long lines into account.
Returns the number of running httpd processes