above line in .bash_profile will give you window title in putty or terminal client when you login to your remote server
Ever need to know why Apache is bogging down *right now*? Hate scanning Apache's Extended server-status for the longest running requests? Me, too. That's why I use this one liner to quickly find suspect web scripts that might need review. Assuming the Extended server-status is reachable at the target URL desired, this one-liner parses the output through elinks (rendering the HTML) and shows a list of active requests sorted by longest running request at the bottom of the list. I include the following fields (as noted in the header line): Seconds: How long the request is alive PID: Process ID of the request handler State: State of the request, limited to what I think are the relevant ones (GCRK_.) IP: Remote Host IP making the request Domain: Virtual Host target (HTTP/1.1 Host: header). Important for Virtual Hosting servers TYPE: HTTP verb URL: requested URL being served. Putting this in a script that runs when triggered by high load average can be quite revealing. Can also capture "forgotten" scripts being exploited such as "formmail.pl", etc. Show Sample Output
convenience.
Use carefully have rm -rf ;-)
It would be nice if commandlinefu.com had a better domain name. Will they pick one of the above; We'll see. Show Sample Output
FreeBSD version of the Linux command
mount discimg.iso /cdrom -o loop
The "mdconfig" command creates a device and prints the name (typically "md0"). Just append that to "/dev/" and mount.
Once unmounted, you can unconfigure the device with
mdconfig -d -u 0
using "0" for md0, "1" for md1, etc.
tail would be considered dull, but pair this with being able to push out unix commands over ARD, and life gets easier. (Same can be said for my TimeMachine scrape command, http://xrl.us/begrzb) Show Sample Output
Useful to check DDoS attacks on servers. Show Sample Output
Many sites with Flash video players will download video files to /tmp on Linux, with temporary filenames like "FlashbGTHm4". These will often play in mplayer, totem, or other movie playing software. You must first navigate to a video page, let it start loading, and then pause playback.
While they are few config options and even fewer useful details regarding what actually is being sent by the time machine 'backupd' process, this can at least tell you its doing something, how much it's doing, and exactly how often. Via macosxhints, http://xrl.us/begrwa, which in turn was via comments Show Sample Output
If your CVS server has moved, here's a way to update your CVS Root files throughout your code tree without checking out a new copy of your files.
An apt-get wrapper function which will run the command via sudo, but will run it normally if you're only downloading source files.
This was a bit of an excuse to show off the framework of
cmd && echo true || echo false
...but as you can see, you must be careful about what is in the "true" block to make sure it executes without error, otherwise the "false" block will be executed.
To allow the apt-get return code to pass through, you need to use a more normal if/else block:
apt-get () { if [ "$1" = source ]; then command apt-get "$@"; else sudo apt-get "$@"; fi }
This was gotten from http://www.veen.com/jeff/archives/000573.html. The line will grab all the mp3 files on the urls listed in text file sourceurls.txt (one url per line) . A much more complete breakdown of the line can be found at the web site mentioned above.
Found here: http://xentek.net/xentek/315/recursively-delete-svn-folders/ This is fast and efficient because rm is only run once.
These days, most software distributed in tar files will just contain a directory at the top level, but some tar files don't have this and can leave you with a mess of files in the current folder if you blindly execute
tar zxvf something.tar.gz
This command can help you clean up after such a mistake. However, note that this has the potential to do bad things if someone has been *really* nasty with filenames.
The "vorbiscomment" utility lets you update information such as artist names and song and album tags in an Ogg Vorbis file. You can use this command to fix any mistakes that were made when ripping an album.
Yet another ps grep function, but this one includes the column headings. Show Sample Output
The $[...] block in bash and zsh will let you do math.
echo $[6*7]
This is the same as using $((...)), which also works in ksh. Of course, this is a simple, dumb wrapper and doesn't allow floating-point.
Show Sample Output
MIME::Base64 is a part of Perl5 distribution. You can also use decode_base64 for oposite result. 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: