Commands using perl (369)

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

BASH one-liner to get the current week number
Not as cool as the python example, but it still works.

limit the cdrom driver to a specified speed
this command limit the speed to 8 until next eject of your cdrom disc , can be usefulll when you don't want to listen the sound of your cdrom driver .

Content search.
Grep will read the contents of each file in PWD and will use the REs $1 $2 ... $n to match the contents. In case of match, grep will print the appropriate file, line number and the matching line. It's just easier to write $ ff word1 word2 word3 Instead of $ grep -rinE 'word1|word2|word3' .

Recursively find top 20 largest files (> 1MB) sort human readable format
from my bashrc ;)

Start a game on the discrete GPU (hybrid graphics)
On laptops featuring hybrid graphics and using the free X drivers, the DRI_PRIME variable indicates which GPU to run on. This alias allows to utilize the faster discrete GPU without installing proprietary drivers.

function to verify an IP address - can be used at the shell prompt or in a shell script
When processing IP addresses in the shell (or shell script) it is useful to be able to verify that the value of data is an IP address (an not some random string or non-sensible IP address).

Check a server is up. If it isn't mail me.
This version uses netcat to check a particular service.

Use mplayer to save video streams to a file
I use this command to save RTSP video streams over night from one of our national TV stations, so I won't have to squeeze the data through my slow internet connection when I want to watch it the next day. For ease of use, you might want to put this in a file: #!/bin/bash FILE="`basename \"$1\"`" mplayer -dumpstream -dumpfile "$FILE" -playlist "$1"

Email yourself a short note
I created this so I could send myself an email alert when a long-running job was finished, e.g., $ my_long_job.exe ; quickemail my_long_job.exe has finished

Netcat Relay
This is an example of using 3 hosts, in a netcat relay. first host connects to middle host 1 -> 2 Second hosts redirects to target host 1 -> 2 -> 3 I hope this makes sense.


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: