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:
Count your source and header file's line numbers. This ignores blank lines, C++ style comments, single line C style comments.
This will not ignore blank lines with tabs or multiline C style comments.
Where filein is the source file, destination.com is the ssh server im copying the file to, -c arcfour,blowfish-cbc is selecting the fastest encryption engines, -C is for online compressions and decompression when it comes off the line - supposed to speed up tx in some cases, then the /tmp/fileout is how the file is saved...
I talk more about it on my site, where there is more room to talk about this:
Or, if you have restricted access for sftp only, I think you can still do this:
diff /path/to/localfile <(scp user@host:/path/to/remotefile >(cat))
For situations where you keep JSON in a VCS and you want your diffs to be sane, such as within a Chef configuration repo.
cut log from line 50 to line 88
cut log from row 100 to row 150.
Valid JSON is a subset of YAML; no transformation is necessary; however, YAML has many syntax features that are not valid JSON, so you can't do the reverse as easily.
I know how hard it is to find an old command running through all the files because you couldn't remember for your life what it was. Heres the solution!! Grep the history for it. depending on how old the command you can head or tail or if you wanted to search all because you cannot think how long ago it was then miss out the middle part of the command. This is a very easy and effective way to find that command you are looking for.
remove old index.html if you download it again and organiaz the java script tag on the file index.html
Go to "https://twitter.com/search/realtime?q=%23TeamFollowBack&src=hash" and then copy al the text on the page. If you scroll down the page will be bigger. Then put al the text in a text file called twit.txt
If you follow the user there is a high probability the users give you follow back.
To follow all the users you can use an iMacros script.
This exports all lines of input file as environment variables, assuming each line is like these:
Replace "user/sbin/sshd" with the file you would like to check. If you are doing this due to intrusion, you obviously would want to check size, last modification date and md5 of the md5sum application itself. Also, note that "/var/lib/dpkg/info/*.md5sums" files might have been tampered with themselves. Neither to say, this is a useful command.
echo "ls" > script.bash;
This is my script, a simple 'ls'.
gpg -c script.bash;
Here I encrypt and passord-protect my script. This creates file script.bash.gpg.
cat script.bash.gpg | gpg -d --no-mdc-warning | bash
Here I open file script.bash.gpg, decrypt it and execute it.
(Please see sample output for usage)
Use any script name (the read command gets it) and it will be encrypted with the extension .crypt, i.e.:
myscript --> myscript.crypt
You can execute myscript.crypt only if you know the password. If you die, your script dies with you.
If you modify the startup line, be careful with the offset calculation of the crypted block (the XX string).
Not difficult to make script editable (an offset-dd piped to a gpg -d piped to a vim - piped to a gpg -c directed to script.new ), but not enough space to do it on a one liner.
Sorry for the chmod on parentheses, I dont like "-" at the end.
Thanks flatcap for the subshell abbreviation to /dev/null
rm --> 16-bit processor (real mode)
tm --> 32-bit processor (? mode)
lm --> 64-bit processor (long mode)