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:
Remove all zero size files from current directory. Its a not recursive option like:
find . -size 0c -exec rm {} \;
A nice way to use the console in full screen without forget the current time.
you can too add other infos like cpu and mem use.
Center the output text in max line length of buffered output pipe;
pev: PE version utility, to show the Product Version of compiled PE files
tarball: http://www.mentebinaria.com.br/coding40/pev-0.22.tar.gz
source: https://github.com/merces/pev
I have a server with a php requiring basic authentication, like this:
header('WWW-Authenticate: Basic realm="do auth"');
header('HTTP/1.0 401 Unauthorized');
...?>
And the basic authentication in wget do not worked:
wget --auth-no-challenge --http-user="username" --http-password="password" -O- "http://url"
wget --keep-session-cookies --save-cookies=cookies.txt --load-cookies=cokies.txt --http-user="username" --http-password="password" -O- "http://url"
I always received the 401 Authorization failed.
The saved cookie is always empty.
With my way, I received the header from the server and save the cookie, then resend the session cookie with authentication data
Sometimes you want to write the script output to stdout but you need to send it to email.
If you use:
var="$( ls / )";
echo -e "$var";
works but, you need to wait the script terminate to bufferize then print the output var;
With this way, you can use/work/print the output before the variable receive all the output content, then after it you can use the variable for anything else, like send email.
Useful to recover a output(stdout and stderr) "disown"ed or "nohup"ep process of other instance of ssh.
With the others options the stdout / stderr is intercepted, but only the first n chars.
This way we can recover ALL text of stdout or stderr
there's some options, see more details in :
wmic /?
wmic process /?
wmic process list /?
Sometimes you don't want to leave history, because of passwords use or somethink like.
I think it help.
specially usefull for sql scripts with insert / update statements, to add a commit command after n statements executed.
the database client sqlplus generate results one line per row.
This function convert the sqlplus output to show the result vertically, in layout:
Column_name=[Column_Value].
Very usefull for scripts.
generates a picture file with the text.
Some other samples in: