Arkiv

Arkiv för mars, 2011

Lösenordsskyddad: Video Skola

mars 25th, 2011 Ange ditt lösenord för att visa kommentarerna.

Det här innehållet är lösenordsskyddat. Vänligen ange ditt lösenord nedan för att visa innehåll:

Categories: Programmering Taggar:

Clean thumbnail cache with a cron script

mars 10th, 2011 Inga kommentarer

In a Linux machine using Nautilus there are a folder called ”.thumbnails” in the users home directories. This folder can grow quite a lot when the system are building new thumbnail images for your pictures. A good idéa can be to clean this out every month.

Make this script in your home folder:

find ~/.thumbnails -type f -atime +7 -exec rm {} \;

The script removes files not used in seven days. Make the script executable:

chmod u+x cleanthumbs.sh

Run the script with cron:

crontab -e

Add a line to the bottom of the file to run your script once a month:

@monthly /home/yourusername/cleanthumbs.sh

Test the script manually before adding it to the crontab. First check how big your thumbnail folder are with the command:

du -sh $HOME/.*

This will list all hidden folders in your home folder. Run the script and then check the folder size again. My thumbnail folder decreased in size from 230MB to 4MB.

Categories: Bash, Linux Taggar:

Convert a DMG image to IMG

mars 9th, 2011 Inga kommentarer

First, install ”dmg2img” through the Ubuntu programs. Next run the util:

user@computer$ dmg2img mac-image.dmg new-image.img


dmg2img v1.6.2 is derived from dmg2iso by vu1tur (to@vu1tur.eu.org)


mac-image.dmg --> new-image.img


reading property list, 1632063 bytes from address 6107371782 ...


decompressing:
opening partition 0 ...             100.00%  ok


Archive successfully decompressed as new-image.img


You should be able to mount the image [as root] by:


modprobe hfsplus
mount -t hfsplus -o loop new-image.img /mnt
Categories: Bash, Linux, Mac, Ubuntu Taggar:

Find the process using a mounted device

mars 9th, 2011 Inga kommentarer

If you’re trying to unmount a device (USB-drive or similar) and you’re getting the error ”device is busy”, try the following:

[root@server]# umount /dev/sdm1
umount: /mnt/disken: device is busy
[root@server]# fuser -m /dev/sdm1
/dev/sdm1:           22121c
[root@server]# ps auxw|grep 22121
root     22121  0.0  0.2  4264 1304 pts/0    S    08:38   0:00 -bash
root      1696  0.0  0.1  3684  556 pts/0    R    10:26   0:00 grep 22121
[root@server]#

In this case it’s the ’bash’ process that’s holding the device. Quit the PuTTY session, reconnect and umount the device!

Categories: Bash, Linux Taggar: