The "g" at the end is for global, meaning replace all occurrences and not just the first one.
sometimes you got conflicts using SSH (host changing ip, ip now belongs to a different machine) and you need to edit the file and remove the offending line from known_hosts. this does it much easier. Show Sample Output
Replaces every ocurrence of 'old' for 'new' in all files specified. After the 'i' char you can put a '~' or whatever to create a backup file for each replaced with the name equal to the original plus character.
Quick command to check if Perl library is installed on your server. Show Sample Output
This removes the type prefix used in Hungarian notation (v. bad) for PHP variables. Eg. variables of the form $intDays, $fltPrice, $arrItems, $objLogger convert to $days, $price, $Items, $logger.
Adds a newline to the end of all cpp files in the directory to avoid warnings from gcc compiler.
Converts windows lined-style file to unix. see http://en.wikipedia.org/wiki/Newline Can be used to convert from linux2dos : just invert \r\n and \n.
Consider this line : random perl language this make possible is is possible to rearrange words with $F perl variable and word index, starting from 0. Show Sample Output
get a list of temps of your hard-drives. Show Sample Output
Using perl, here, we grep the man page of fetchmail to find the paragraph starting with '-k | --keep' and ending before the paragraph starting with '-K | --nokeep' Show Sample Output
This command will output 1 if the given argument is a valid ip address and 0 if it is not. Show Sample Output
substitute the URL with your private/public XML url from calendar sharing settings substitute the dates YYYY-mm-dd adjust the perl parsing part for your needs Show Sample Output
Alter "AddHandler php5-cgi .php" and "AddHandler php4-cgi .php" entries to new "AddHandler x-httpd-php5 .php" respective php4 entries in all .htaccess files under /var/www Show Sample Output
This is an extension of a previous command by satyavvd on 2009-07-23 12:04:02, but this one grabs the whole archive. Hard coded numbers in previous script capped number of commands that could be fetched. This one grabs them all regardless of how big the archive gets. Show Sample Output
This finds all the PowerPC apps recognized by OS X.
A better version is:
system_profiler SPApplicationsDataType 2> /dev/null | perl -
wnl -e '$i=$j=$k=$p=0; @al=; $c=@al; while($j
s[$i].=$al[$j]; $i++ if ($al[$j]) =~ /^\s\s\s\s\S.*:$/; $j++} while($k
apps[$k++]; if (/Kind: PowerPC/s) {print; $p++;}} print "$i applications, $p P
owerPC applications\n\n"'
but that is more than 255 characters...
print scalar gmtime
Fixes the faulty files with perl, which may exist on more platforms
This dumps all of your installed perl's config information.
This will show where your Perl installation is looking for modules.
The sort utility is well used, but sometimes you want a little chaos. This will randomize the lines of a text file.
BTW, on OS X there is no
| sort -R
option! There is also no
| shuf
These are only in the newer GNU core...
This is also faster than the alternate of:
| awk 'BEGIN { srand() } { print rand() "\t" $0 }' | sort -n | cut -f2-
Show Sample Output
not my cmd... found on the web Show Sample Output
List packages and their disk usage in decreasing order. This uses the "Installed-Size" from the package metadata. It may differ from the actual used space, because e.g. data files (think of databases) or log files may take additional space. Show Sample Output
If you are interested in interfaces other than eth0 you will need to change eth0 to your interface name. You could use this mammoth to nab the ip4 addresses of all your interfaces perl -e '@_=`ifconfig -a`; sort(@_); foreach(@_) { /(inet addr\:)(\d+.\d+.\d+.\d+ )/; $_=$2; @uniq=grep($_ ne $prev && (($prev) = $_), @_);} print join "\n",@uniq,"\n"; ' it seems silly to have all this code when the following will work fine ifconfig -a | grep "inet " | awk -F":" ' { print $2 } ' | cut -d " " -f1 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: