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:
just bored here at work ... if your are daring ... add '| bash' .... enjoy
require 'ruby'
The check an entire folder is a one-liner:
plutil -lint * | grep -v OK$
from Ed Marczak
This is helpful for shell scripts, I use it in my custom php install script to schedule to delete the build files in 3 hours, as the php install script is completely automated and is made to run slow.
Does require at, which some environments without crontab still do have.
You can add as many commands to the at you want. Here's how I delete them in case the script gets killed. (trapped)
atq |awk '{print $1}'|xargs -iJ atrm J &>/dev/null
This command runs your shell script in the background with no output of any kind, and it will remain running even after you logout.
The coolest way I've found to backup a wordpress mysql database using encryption, and using local variables created directly from the wp-config.php file so that you don't have to type them- which would allow someone sniffing your terminal or viewing your shell history to see your info.
I use a variation of this for my servers that have hundreds of wordpress installs and databases by using a find command for the wp-config.php file and passing that through xargs to my function.
I used this to copy all PDFs recursively to a selected dir
This allows the output to be sorted from largest to smallest in human readable format.
Nothing advanced, it just finds filenames that are stored with ISO-8859-1 characters and and converts those into UTF-8. Recommended to use without the --notest flag first so you can see what will be changed.
Can be used to help perform some SEO optimizations.
Using a GUI file managers you can merge directories (cut and paste). This command roughly does the same (it doesn't ask for confirmation (no problem for me) and it doesn't clean up the empty SRC directories (no problem, trivial).
probably does the same:
cp -l SRC TARGET; rm -rf SRC
Postgresql specific SQL
- to show count of ALL tables including relation-size (pg_relation_size = used space on filesystem)
- might need a VACUUM ANALYZE before showing all counts correctly !
inside vim try:
:help 42
to get the meaning of life, the universe and everything !
Given a file of FQDN, this simple command resolves the IP addresses of those Useful for log files or anything else that outputs domain names.
converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats ... It also supports LSB packages.
This is exactly the same as a wildcard - good for times when wildcards are disabled and when you want have a wildcard of a directory that is not your current ({`ls /path/to/dir`}). Does not work on older versions of Bash though.
This will unarchive the entire working directory. Good for torrents (I don't know why they put each file into a seperate archive).
diff is designed to compare two files. You can also compare directories. In this form, bash uses 'process substitution' in place of a file as an input to diff. Each input to diff can be filtered as you choose. I use find and egrep to select the files to compare.
This is the same command as this one, but for OS X.
This is the same command as this one, but for OS X.