Sunday, December 16, 2012

Reference for some nifty Linux tricks

CLI is fun, but the commands can be a bit of a pain to remember. Here's some stuff I'm writing for my own reference, but it might be useful to you too.

1. Create a disk image

dd if=/dev/sda of=<fileName>

Web references also specify block size etc, but I didn't need them, apparently.

2. Mount that disk image

mount -o loop,offset=$START*512 -t [auto|FSType] /path/to/image /mount/point

loop - used to mount files as block devices or something

$START - the start value of that partition in fdisk -l or fdisk /path/to/image

3. Turn screen off (as in power save mode)

xset dpms force off
xset dpms force off; xscreensaver-command --lock #[Locks screen also] 
 
 
4. Find the process using a file

fuser /dev/sda3
fuser /path/to/file

 
5. Spindown your HDD (eject from nautilus doesn't work)

Obtain the sdX->sgY mapping
sg_map

sdparm -C stop /dev/sgY

6. Install Ubuntu on newer UEFI systems along with Windows 8.

Ok, so Wubi won't work on the newer UEFI-enabled systems. So don't even bother. Either use Ubuntu as a Virtual Machine (tsk tsk...) or follow this guide.

http://askubuntu.com/questions/221835/installing-ubuntu-on-a-pre-installed-windows-8-64-bit-system-uefi-supported

No comments:

Post a Comment