25 November 2014

Shredding Files / Delete Files without being Possible Restored

These are the step:
  • Find the file(s) and put it on the list

$ find -iname "*" -type f > /home/firmansyah/DELETE.txt
  • Shred the Files "TahapII.doc"

$ shred -fzvu -n 3 "TahapII.doc"
  • Shred all the Files in the directory

$ shred -fzvu -n 3 *
  • Shred the Files using the list

$ shred -fzvu
     -n 3
     --random-source=/home/firmansyah/DELETE.txt perda_rtrw_paripurna.msg

Find A File using Pattern and Executing Command

Find files with ".txt" extension and then delete the file

find . -name "*.txt" -print0 | xargs -0 rm


Find files contain "empathy" extension and show the files list

find ~ -iname '*empathy*' -print

Battery Status Command Line

watch --interval=5 acpi -V

Rip DVD to File

Prequisities:

  • Mencoder Installed


mencoder dvd://1 -dvd-device /dev/sr1
    -alang English
    -sid 0
    -info srcform="DVD ripped by acidrip.sf.net"
    -oac mp3lame
    -lameopts abr:br=128
    -ovc lavc
    -lavcopts vcodec=mpeg4:vhq:v4mv:vqmin=2:vbitrate=1076
    -vf pp=de,crop=0:0:0:0,scale=480:-2 -o
    "/home/firmansyah/12 Year A Slave.avi"

Free Up Space by Cleanup Previous Kernel

cd \lib\modules
sudo dpkg -r linux-image-3.5.0-47-generic

Log Keyboard activity

sudo logkeys -s -o /home/firmansyah/keylogs.log

Add New Font

Add the font file
Build font information cache files
sudo fc-cache -fv

Rotate PDF File

Prequisities:

  • PDFTK installed

To rotate 270 degree:

pdftk BRM-III.pdf cat 1-endW output III.pdf (west-270)
To rotate 180 degree:

pdftk BRM-III.pdf cat 1-endS output III.pdf (south-180)
To rotate 270 degree:

pdftk BRM-III.pdf cat 1E 2-end output 1.pdf (counterclockwise90)

Image Resize

Prequisities:

  • ImageMagick Installed


mogrify -verbose -resize 768x1024 -format jpg *.JPG

Distribute Image Based on Size using Bash Script

Taken from https://superuser.com/questions/17562/how-to-sort-images-into-folders-based-on-resolution/591490#591490

  • Create this script on the directory of the Images
  • Save the script as (for example) scriptdistribute.sh
  • chmod a+x scriptdistribute.sh
  • Run the script ./scriptdistribute.sh


#!/bin/bash

for image in *.jpg *.JPG *.jpeg *.JPEG *.gif *.GIF *.bmp *.BMP *.png *.PNG;
    do res=$(identify -format %wx%h\\n "$image");
    mkdir -p $res;
    mv "$image" $res;
done

GPG Encrypting A File

$ gpg -c file.to.encrypt
$ gpg file.to.encrypt.gpg

Boot Fail After Edit Fstab

The problem lies with your fstab. When you created the new raid array, it ended up with a new UUID which is what you are using to specify your root filesystem. It looks like you can get to busybox (the emergency shell). Try:

  • Mount up your root filesystem manually
  • Edit /etc/fstab
  • Put in the correct UUID (you can get it with blkid /dev/sdX1 or the output from your mdadm output in your screenshot)
You will need to remount root as read/write to edit fstab

  • mount -o remount,rw /

Mount ISO images under Linux

1) You must login as a root user, if not root user then switch to root user using following command:

$ su -

2) Create the directory i.e. mount point:

# mkdir -p /mnt/disk

3) Use mount command as follows to mount iso file called disk1.iso:

# mount -o loop disk1.iso /mnt/disk

4) Change directory to list files stored inside an ISO image:

# cd /mnt/disk
# ls -l


24 November 2014

Menjalankan Bitnami VM menggunakan QEMU-KVM


Taken from http://hansen.alfansa.org/2012/10/bitnami-kvm/

Virtual machine dari Bitnami merupakan VMWare virtual machine. Agar bisa dijalankan menggunakan QEMU-KVM dengan antar muka virt-manager, perlu kita rubah dulu menjadi img file yg didukung oleh QEMU-KVM. Berikut langkah-langkahnya:


  • Download VM dari Bitnami, misal http://bitnami.org/files/stacks/lampstack/5.3.17-0/bitnami-lampstack-5.3.17-0-ubuntu-12.04.zip
  • Unzip file tersebut:

  • $ unzip bitnami-lampstack-5.3.17-0-ubuntu-12.04.zip

  • Hasilnya adalah beberapa file vmdk dan lainnya, file img-nya adalah bitnami-lampstack-5.3.17-0-ubuntu-12.04-s00*.vmdk. Ini yg perlu kita rubah menjadi img yang didukung QEMU-KVM
  • Rubah semua vmdk img tersebut menggunakan qemu-img

  • $ cd bitnami-lampstack-5.3.17-0-ubuntu-12.04
    $ qemu-img convert -p -O qcow2 bitnami-lampstack-5.3.17-0-ubuntu-12.04-s00* bitnami-lampstack.qcow2


  • Hasil img-nya berformat qcow2 dan kita namakan bitnami-lampstack.qcow2
  • Kita akan menggunakan virt-manager untuk aplikasi vm-nya. Pindahkan img tersebut ke folder default img-nya libvirt

  • # mv /home/mht/Downloads/bitnami-lampstack.qcow2 /var/lib/libvirt/images/

  • Selanjutnya jalankan virt-manager dan buat vm baru dengan pilihan menggunakan file img yang sudah ada


Nah, virtual appliance dari Bitnami bisa dijalankan tanpa vmware ataupun virtualbox ;-)