wipe your disk
Overwrite all partitions, the master boot record, and data:
dd if=/dev/zero of=/dev/sda bs=4M
This will overwrite everything with zeros (0).
Overwrite (more securely) all partitions, the master boot record, and data:
dd if=/dev/urandom of=/dev/sda bs=4M
Home of dd_rescue is <http://www.garloff.de/kurt/linux/ddrescue/>
dd_rescue is your friend if you have to recover data from a crased harddrive. This tool will scratch all recoverable data out of your broken drive.
# standard run:
dd_rescue input output
(rescue hard disk helper) - bash script to manage dd_rescue conveniently
Create a diff to be used to patch a file ..,
Create the diff
diff -c nrpe.cfg nrpe.cfg.new > nrpe.cfg.patch
Patch it on a different machine:
patch < nrpe.cfg.patch
* <http://www.heise.de/ix/artikel/2001/07/164/> (german)
Howto count files in a directory (wc will count the lines)
find . | wc -l
if you want only files, use:
find . -not -type d | wc -l
and if you don't want to dive into subdirectories:
find . -not -type d -maxdepth 1 | wc -l
screen - screen manager with VT100/ANSI terminal emulation
screen is extremely helpful for long running programs or commands, e.g. backups. Once started in screen, you can safely detach from the session and reattach at any time. No termination of commands, no unintended cancelation of tasks.
to revert the search use -v:
grep -v 'pattern' file
extract config lines omitting remarks (#) and empty lines:
grep -v '^#' file.conf | grep -v '^$'
print also the filename where pattern matches:
grep -H 'pattern' *
watch disk usage while you're copying data to your usb drive:
A powerful ftp client: lftp
Mirror Directories via FTP
Have you ever encountered the problem to backup a complex webspace, only accessible via ftp? No chance to tar or rsync? Then you need a good ftp client capable of doing a recursive download of the site, optimally able to mirror source and destination.
The Mutt Mail User Agent
t - tag (mark) a message
T - tag messages with regex
; - tag prefix, run next command with tagged messages
b - bounce a mail
;b - bounce all tagged messages
Move around in mutt:
j or Down next-entry move to the next entry
k or Up previous-entry move to the previous entry
z or PageDn page-down go to the next page
Z or PageUp page-up go to the previous page
= or Home first-entry jump to the fir…
||parted - gpt
Howto prepare your partitioning in order to create a software raid on top of gpt partitions.
GNU Parted 2.4
Welcome to GNU Parted! Type 'help' to view a list of commands.
Create a fresh gpt label, erase any preexisting partitions:
||recode - dos2unix - unix2dos
recode - converts files between character sets
Very handy tool to correct line feed and carriage return when you messed up these on windows and need to run a script on linux:
recode 'ibmpc..lat1' file
recode 'lat1..ibmpc' file
Ever tried to rename a bunch of files? What's so easy in Windows won't work with the standard mv command. mv doesn't like wildcards and refuses to rename multiple files.
The solution is rename
# dry run/just show what would be done:
rename -n 's/\.JPG/\.jpg/' *.JPG
# rename all files in the current directory with a ".PNG" ending to ".png":
rename 's/\.PNG/\.png/' *.PNG