Note that this will not work with files with spaces or characters that need to be escaped. Feel free to leave any comments to improve upon this command, and I'll add it in. Thanks! Show Sample Output
Lists crontab for all users on system that have crontabs. Show Sample Output
This works on some other version of read.
With counter format [001, 002, ..., 999] , nice with pictures or wallpapers collections.
Grep for a named process. Show Sample Output
manda la salida de un comando hacia un servicio de paste y coloca la url de ese paste en el portapapeles
Matrix Screen HPUX
This is /bin/sh compatible.
bash
Suppose you have 11 marbles, 4 of which are red, the rest being blue. The marbles are indistinguishable, apart from colour. How many different ways are there to arrange the marbles in a line? And how many ways are there to arrange them so that no two red marbles are adjacent? There are simple mathematical solutions to these questions, but it's also possible to generate and count all possibilities directly on the command line, using little more than brace expansion, grep and wc! The answer to the question posed above is that there are 330 ways of arranging the marbles in a line, 70 of which have no two red marbles adjacent. See the sample output. To follow the call to marbles 11 4: after c=''; for i in $(seq $1); do c+='{b,r}'; done;, $c equals {b,r}{b,r}{b,r}{b,r}{b,r}{b,r}{b,r}{b,r}{b,r}{b,r}{b,r} After x=$(eval echo $c), and brace expansion, $x equals bbbbbbbbbbb bbbbbbbbbbr ... rrrrrrrrrrb rrrrrrrrrrr, which is all 2^11 = 2048 strings of 11 b's and r's. After p=''; for i in $(seq $2); do p+='b*r'; done;, $p equals b*rb*rb*rb*r Next, after y=$(grep -wo "${p}b*" Finally, grep -vc 'rr' Show Sample Output
This one is a little bit easier for those of us that aren't always root.
if Argument list too long
Generates a password using symbols, alpha, and digits. No repeating chars. Show Sample Output
It clears caches from memory. It works fine on CentOS and Fedora. It will show you how much memory you need, for real.
It will return the absolute location of the called a script. If is in $PATH, it will search it using which.
You can combine this function with this other one: http://www.commandlinefu.com/commands/view/9252/readlink-equivalent-using-shell-commands-and-following-all-links, to get a way to know where is the real location of a called script:
# Returns the realpath of a called command.
whereis_realpath() { local SCRIPT_PATH=$(whereis $1); myreadlink ${SCRIPT_PATH} | sed "s|^\([^/].*\)\$|$(dirname ${SCRIPT_PATH})/\1|"; }
Show Sample Output
alternative to tr char '\012' works with sed's that don't accept "\n" allows for multi-char sentinals, while tr(1) only operates on single chars
Writes out the shebang line (#!/bin/bash) to the script.
CPU flags: rm --> 16-bit processor (real mode) tm --> 32-bit processor (? mode) lm --> 64-bit processor (long mode)
or
which <command> > /dev/null 2>&1 || echo Error!
For example, I write
which colordiff > /dev/null 2>&1 && alias diff=colordiff
in my `~/.bashrc`.
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: