Sunday, January 29, 2012

My howto file in ~/howto

#####################################
#this is text file with useful tips##
#####################################
download youtube with command: youtube-dl
get all links on website: get-links.py #optional: > atextfile.txt

download packages and all dependencies
use 'python grabpackages.py -o '
then copy and paste contents of to command line and push enter to initiate download into current directory.

To save the MBR to a file (this contains the partition table too):
dd if=/dev/hda of=hda-mbr-full bs=512 count=1

To save the MBR, without the partition table, to a file:
dd if=/dev/hda of=hda-mbr-nopart bs=446 count=1

To save a boot sector (e.g. partition 3) to a file:
dd if=/dev/hda3 of=hda3-bootsect bs=512 count=1
MBR TOTAL SIZE = 446 + 64 + 2 = 512
446 bytes - Bootstrap.
64 bytes - Partition table.
2 bytes - Signature.

Use 446 bytes to overwrite or restore your /dev/XYZ MBR boot code only with the contents of $mbr.backup.file.
Use 512 bytes to overwrite or restore your /dev/XYZ the full MBR (which contains both boot code and the drive's partition table) with the contents of $mbr.backup.file.

for example, if identically sized partitions on origin and destination,
this command will copy 512 bytes (MBR) from sda to sdb disk.
dd if=/dev/sda of=/dev/sdb bs=512 count=1

different size partitions-two step process
dd if=/dev/sda of=/tmp/mbrsda.bak bs=512 count=1
dd if=/tmp/mbrsda.bak of=/dev/sdb bs=446 count=1

The above commands will preserve the partitioning schema.
####################
####################



edit a file in root mode with textedit
$ gksudo gedit

set vlc as main media player for everything
gksudo gedit the following and do a search & replace of totem and replace with vlc
/usr/share/applications/defaults.list

check size of directory
$ du -h /foldername --human readable
$ du -ah /foldername --all filenames along with the directory
$ du -c /foldername --grand total

usb-creator-gtk

find router address
$ route -n
OR
$ netstat -r

remove empty folders
find . -type d -empty -delete

recursively move files
find . -name '*.flv' -exec mv {} flv \;

how to extract tar.gz
tar xyvf

how to setup various settings, like auto open a mounted drive in nautilus
gconf-editor

python documentation server
pydoc -g
#####BASH WILDCARDS######
Wildcard Matches
* zero or more characters
? exactly one character
[abcde] exactly one character listed
[a-e] exactly one character in the given range
[!abcde] any character that is not listed
[!a-e] any character that is not in the given range
{debian,linux} exactly one entire word in the options given

No comments:

Post a Comment