Starting with a large MySQL dump file (*.sql) remove any lines that have inserts for the specified table. Sometimes one or two tables are very large and uneeded, eg. log tables. To exclude multiple tables you can get fancy with sed, or just run the command again on subsequently generated files.
Normally, searching git log comments is case sensitive. The -i luckily applies to the --grep switch.
Useful for when you download movies split into < 700mb parts.
Credit to rich @ http://superuser.com/questions/318640/merge-avi-files-without-recoding-in-mac-os-x-lion
mencoder is generally included with mplayer.
MacPorts:
sudo port install mplayer
Show Sample Output
Remove the "echo" to actually archive.
Many similar commands are found on commandlinefu but I end up needing this very specific one from time to time.
To extract any of them, use the standard tar.bz2 extract command:
tar xvjf folder1.tar.bz2
Show Sample Output
Can't remember what that one package was called? Search for it!
It's also a good idea to run
apt-get update
first.
Show Sample Output
converts RAW files from a Nikon DSLR to jpg for easy viewing etc. requires ufraw package
pings a server once per second, and beeps when the server is unreachable.
Basically the opposite of:
ping -a server-or-ip.com
which would beep when a server IS reachable.
You could also substitute beep with any command, which makes this a powerful alternative to ping -a:
while true; do [ "$(ping -c1W1w1 server-or-ip.com 2>/dev/null | awk '/received/ {print $4}')" = 1 ] && date || echo 'server is down!'; sleep 1; done
which would output the date and time every sec until the ping failed, in which case it would echo.
Notes:
Requires beep package.
May need to run as root (beep uses the system speaker)
Tested on Ubuntu which doesn't have beep out of the box...
sudo apt-get install beep
Seems obvious, but other seemingly simple ways to use it don't work:
echo !whammy
and
echo "!whammy"
both output:
-bash: !whammy: event not found
and this:
echo "\!whammy"
outputs:
\!whammy
with the slash :(
you can also do any combinations of quotes for a complex string:
echo "It's great to be able to use a bang ("'!'") in a command"'!'
outputs:
It's great to be able to use a bang (!) in a command!
Show Sample Output
Most people know that you can run a PHP script from the command line like so:
php ./my_script.php
But sometimes I just want to run a quick bit of code, the PHP Command Line Interface allows me to do so with the -r option.
Requires package php5-cli
Show Sample Output
rsyncs files to a server excluding listed files
also a file can be used to exclude common exclude rules and/or to exclude a ton of files, like so:
rsync --exclude-from '~/.scripts/exclude.txt'
where exclude.txt has one rule per line:
*.mp3
*.svn*
Works for most distributions, tested on Ubuntu, Fedora, CentOS, Gentoo, SUSE, RedHat.
Debian and Slackware:
cat /etc/*version
Show Sample Output
commandlinefu.com is the place to record those command-line gems that you return to again and again. 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.
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: