The number on the far right is ratio of comments to code, expressed as a percentage. For the rest of the Yardstick documentation see https://github.com/calmh/yardstick/blob/master/README.md#reported-metrics Show Sample Output
find ip address in all files in /etc directory. can be used to find any string in any directory really
This one has a better performance, as it is a one pass count with awk. For this script it might not matter, but for others it is a good optiomization.
Required : information_schema ** Only replace the "DB-NAME" and "PREFIX" with your DB-name and wildcard prefix match. ** Also replace with your own username and password for mysql server. This command uses the information_schema to wildcard match tables that we donot need from a database and than pipes the remaining tables out through "xargs" command to the mysqldump utility which than dumps those remaining tables into a sql dump file. Show Sample Output
The "find $stuff -print0 | xargs -0 $command" pattern causes both find and xargs to use null-delineated paths, greatly reducing the probability of either hiccuping on even the weirdest of file/path names.
It's also not strictly necessary to add the {} at the end of the xargs command line, as it'll put the files there automatically.
Mind, in most environments, you could use find's "-exec" option to bypass xargs entirely:
find . -name '*.jpg' -o -name '*.JPG' -exec mogrify -resize 1024">" -quality 40 {} +
will use xargs-like "make sure the command line isn't too long" logic to run the mogrify command as few times as necessary (to run once per file, use a ';' instead of a '+' - just be sure to escape it properly).
It starts in the current working directory.
It removes the empty directory and its ancestors (unless the ancestor contains other elements than the empty directory itself).
It will print a failure message for every directory that isn't empty.
This command handles correctly directory names containing single or double quotes, spaces or newlines.
If you do not want only to remove all the ancestors, just use:
find . -empty -type d -print0 | xargs -0 rmdir
The directories are created in the local host with the same structure below of a remote base directory, including the 'basedir' in case that it does not exists. You must replace user and remotehost (or IP address) with your proper values ssh will ask for the password of the user in remotehost, unless you had included properly your hostname in the remote .ssh/known_hosts file. Show Sample Output
Recursively list all files in the current directory & get their md5sum, even if the filename has bad characters. Show Sample Output
On Linux substitute pbpaste with `xsel --clipboard --output` or `xclip -selection clipboard -o` (untested)
Solves these pesky errors you see in the Apache log: [Fri Jun 28 17:51:00 2013] [emerg] (28)No space left on device: Couldn't create accept lock (/monsoon/opt/apache2/logs/accept.lock.356) (5) Naturally, can be used to get rid of other semaphores. Note: change the apache user in accordance to your ENV. Show Sample Output
schema & tables To export into another backends style, just change backend to one of: access, sybase, oracle, postgres, mysql and sqlite Show Sample Output
This command is used to verify a sha256sum-formatted file hash list on IBM AIX or any other UNIX-like OS that has openssl but doesn't have sha256sum by default. Steps: 1: Save to the filesystem a script that: A: Receives as arguments the two parts of one line of a sha256sum listing B: Feeds a file into openssl on SHA256 standard input hash calculation mode, and saves the result C: Compares the calculated hash against the one received as argument D: Outputs the result in a sha256sum-like format 2: Make the script runnable 3: Feed the sha256sum listing to xargs, running the aforementioned script and passing 2 arguments at a time Show Sample Output
This script can be used to download enclosed files from a RSS feed. For example, it can be used to download mp3 files from a podcasts RSS feed. Show Sample Output
My first command :) I made this command to log public addresses of a virtual interface who connects random VPN servers around the world. Show Sample Output
I did not come up with this one myself, but found this somewhere else several months ago. Show Sample Output
* Find all file sizes and file names from the current directory down (replace "." with a target directory as needed). * sort the file sizes in numeric order * List only the duplicated file sizes * drop the file sizes so there are simply a list of files (retain order) * calculate md5sums on all of the files * replace the first instance of two spaces (md5sum output) with a \0 * drop the unique md5sums so only duplicate files remain listed * Use AWK to aggregate identical files on one line. * Remove the blank line from the beginning (This was done more efficiently by putting another "IF" into the AWK command, but then the whole line exceeded the 255 char limit). >>>> Each output line contains the md5sum and then all of the files that have that identical md5sum. All fields are \0 delimited. All records are \n delimited.
If you want to do this in the some one db, use
redis-cli -n5 KEYS "user*" | xargs redis-cli -n5 DEL
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: