commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Declare this function in your Shell, then use it like this:
> jumpTo foo
The script will search for the 'foo' pattern in your current xmms2 playlist (artist or songname), and play the first occurence of it !
Does that count as a win for bzip2?
This little command (function) shows the CSV header fields (which are field names separated by commas) as an ordered list, clearly showing the fields and their order.
Coming back to a project directory after sometime elsewhere?
Need to know what the most recently modified files are?
This little function "t" is one of my most frequent commands.
I have a tcsh alias for it also:
alias t 'ls -ltch \!* | head -20'
Replace < pw-length > with the desired password-length.
The password-length is not always correct, but wayne...
You need curl.. and a Mac of course.
Low on disk space? Check the largest installed RPMs for delete canditates.
Suppose you made a backup of your hard disk with dd:
dd if=/dev/sda of=/mnt/disk/backup.img
This command enables you to mount a partition from inside this image, so you can access your files directly.
Substitute PARTITION=1 with the number of the partition you want to mount (returned from sfdisk -d yourfile.img).
Deletes thousands of files at one go, I'm not able to recall the exact # of files that rm can delete at one go(apprx. around 7000.)
If you want a password length longer than 6, changing the -c6 to read -c8 will give you 8 random characters instead of 6. To end up with a line-feed, use this with echo:
# echo `< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c6`
Pump up the chatter, run this script on a regular basis to listen to your twitter timeline.
This is a rough first cut using several cli clips I have spotted around. There is no facility to not read those things already read to you. This could also easily be put in a loop for timed onslaught from the chatterverse, though I think it might violate several pointsof the Geneva Convention
UPDATE - added a loop, only reads the first 6 twits, and does this every 5 mins.
This will give you the Dell Service tag number associated with your machine. Incredibly useful when you need that number for tech support or downloads.
Find random strings within /dev/urandom. Using grep filter to just Alphanumeric characters, and then print the first 30 and remove all the line feeds.
tells you the number of lines in said file, and then tail the last 100 lines ( or how many are messed up) then u take the total amount of lines and then subract the 100 or so lines u DONT WANT, then do a head -n $new_number and then redirect it to new file.db
while [ 1 -ne 6 ]; do
pid=`ps -ef | grep -v "grep" | grep "trans_gzdy" | cut -c10-17`
ps gv $pid | head -2
check changes of RSS.
Useful for massive files where doing a full diff would take too long. This just runs diff on the first 500 lines of each. The use of subshells to feed STDIN is quite a useful construct.
Must be done as root - will cause subsequent ssh connections to use the identities available via the [user]'s agent socket.