Sunday, March 29, 2009

Bulk rename

Yesterday I wanted to rename a lot of files with the same extension (jpg actually). Knowing that linux is case-sensitive, I wanted to rename every JPG to jpg.

So the trick was to simply write
$rename -v 's/JPG/jpg/g' *.JPG

Inside quotes lies the expression that you want to replace (JPG->jpg, 2nd and 3rd argument). Outside the quotes you must give the files that this expression will work on.

Edit:
$rename -n 's/JPG/jpg/g' *.JPG
will get you to see what exactly is going to change. See here for more perl handling, or here for a more understanding way to rename stuff from terminal.

Thursday, March 12, 2009

Change frequency of filesystem check at boot

Sometimes, even though Ubuntu has the option to press cancel, you think that boot fsck happens way too often. I think that every 50 boots it would be great rather than every 20... So I ran df, just to remember the names of the partitions and
sudo tune2fs -c 50 /dev/sdb1

(where sdb1 was my primary partition). In case you want to check every x days,months or weeks there is this neefty parameter
-i interval-between-checks[d|m|w]

. So the command would be something like this(if you want boh the 50 times interval and 1 month),
sudo tune2fs -c 50 -i 1m /dev/sdb1

With this you can see how much time you've got left
sudo dumpe2fs -h /dev/sdb1 | grep -i 'mount count'

and by editing the sixth(last) column in ftsab
sudo gedit /etc/fstab

The 6th column (in bold) is a fsck options.

  • 0 = Do not check.

  • 1 = First file system (partition) to check;  // (root partition) should be set to 1.

  • 2 = ALL OTHER file systems to be checked.

Wednesday, March 11, 2009

Moving Ubuntu to another partition

So, I bought a new hard disc drive and I just wanted to split my windows installation to that of ubuntu. But I didn't want anything to change. I wanted my ubuntu installation to be exactly as it is. No reinstalling, no tweaking from the start. While moving Windows was a pain, ubuntu was very easy to move.

First of all I used this command line
sudo lshw -businfo -C disk

just to see how linux names my partitions. Using also the "df" command I double-checked that my linux partition was indeed located at sda1 and that I wanted to move it to sdb1. After that, I decided to move my partition with this line
dd if=/dev/sda1 of=/dev/sdb1

Watch that I wanted to move my partition from sda1 (the if parameter) to sdb1 (the of parameter). I must say the partitions were not identical, but we'll get to that in a while. Once finished I shut down the PC. Then I disconnected the sda hard disc drive. Here comes the tricky part. Now I don't recall whether or not I used my live cd... But once I got to the terminal (see ubuntu can't find grub), I typed these lines:
sudo grub
>find /boot/grub/stage1

That will answer a thing something like hd(z,0). Note the z number, you will need it. Then type (and replace the z number to that of your own),
>root hd(z,0)
>setup (hdz)
>quit

And that's it. Linux should now load.

In case that the two partitions were not identical, download and burn to rewritable CD the gparted program, then boot from it. Then just resize the linux partition to whatever size you want, and the sizes will fix.

Saturday, March 7, 2009

Rar crack, pdf crack in linux

And off for a good start.

Ever had your rar/7z/zip files' password forgotten? I sure have. There is an open source program that can handle these files quite well. It is called rarcrack. It is hosted on sourceforge. And in case that you want to crack pdfs, there is the pdfcrack.

What it would be greater though, would be for these two to be written in the new OpenCL... That way, it would be faster. What? You thought that only Elcomsoft had the idea to take advantage of CUDA? Well, it sure wasn't...

--edit
Well, well, well! The day is finally here. cRARk is using Opencl to crack passwords! 

And on this fine day...

This blog starts!

Yeah, I finally succumbed to the idea. My goal is to share stuff, news that are bizarre, videos or photos that are funny, and last but never least, linux & OSX stuff...

Ever frustrated in the *nix world? I am, at least sometimes, so I am sharing all that might help you as well to overcome these obstacles. Sometimes, it is no hurdles, but it can really make a guy (or a girl) angry. And there are times that you need your nix world to be more responsive, do many and more things. Been there, tried to do stuff.

Specifically I'll post stuff regarding one of the most pop distros out there, Ubuntu.

Hope you'll enjoy my blog.