Commands by atcroft (1)

  • This command will generate "CHECK TABLE `db_name.table_name` ;" statements for all tables present in databases on a MySQL server, which can be piped into the mysql command. (Can also be altered to perform OPTIMIZE and REPAIR functions.) Tested on MySQL 4.x and 5.x systems in a Linux environment under bash. Show Sample Output


    -1
    DD=`cat /etc/my.cnf | sed "s/#.*//g;" | grep datadir | tr '=' ' ' | gawk '{print $2;}'` && ( cd $DD ; find . -mindepth 2 | grep -v db\.opt | sed 's/\.\///g; s/\....$//g; s/\//./;' | sort | uniq | tr '/' '.' | gawk '{print "CHECK TABLE","`"$1"`",";";}' )
    atcroft · 2009-07-25 03:42:31 15

What's this?

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.

Share Your Commands


Check These Out

Find number of computers in domain, OU, etc .

Lists installed kernels
no need for rpm, no need for piping to another command. also no real fu but lacking in unnecessary complexity and distro specific commands.

Create the authorization header required for a Twitter stream feed
This is the FOURTH in a set of five commands. Please see my other commands for the previous three steps. This command builds the authorization header required by Twitter. For this command to work, see my previous 3 commands (step1, step2 and step3) as they are required to build the environment variables used in this command. For more information on the authorization header, go to dev.twitter.com/apps, click on any of your apps (or create a new one) and then click on the "OAuth Tool" tab.

backup with mysqldump a really big mysql database to a remote machine over ssh
backup big mysql db to remote machine over ssh. "--skip-opt" option is needed when you can?t allocate full database in ram.

rename anime fansubs
renames Anime Episodes to files, that can be parsed by sonarr & co

Compare two directories
Output of this command is the difference of recursive file lists in two directories (very quick!). To view differences in content of files too, use the command submitted by mariusbutuc (very slow!): $ diff -rq path_to_dir1 path_to_dir2

Create a local compressed tarball from remote host directory
The command uses ssh(1) to get to a remote host, uses tar(1) to archive a remote directory, prints the result to STDOUT, which is piped to gzip(1) to compress to a local file. In other words, we are archiving and compressing a remote directory to our local box.

Remove security limitations from PDF documents using ghostscript
Remove security from PDF document using this very simple command on Linux and OSX. You need ghostscript for this baby to work.

replace a character/word/string in a file using vim
Replace all ocurrences in the file. The g option is to replace more than one occurrence in the same line. Whitout the g option, it only replace the first occurrence in the line.

list files recursively by size


Stay in the loop…

Follow the Tweets.

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

Subscribe to the feeds.

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: