Watch the progress of ‘dd’

Running this command will give you a idea on the progress of dd.

[email protected]:~$ dd if=/dev/urandom of=file.img bs=4KB& pid=$!

Running this code will execute dd in the background, and you’ll grab the process ID with ‘$!’ and assign it to the ‘pid’ variable. Now, you can watch the progress with the following:

[email protected]:~$ while true; do kill -USR1 $pid && sleep 1 && clear; done

The important thing to grasp here isn’t the filename or location of your input or output, or even the block size for that matter, but the fact that you can keep an eye on ‘dd’ as it’s running to see where you are at during its execution.

Use this Linux history command to see the command history

Use this Linux history command to see the command history:

[email protected]:~$ history|awk ‘{print $2}’|awk ‘BEGIN {FS=”|”} {print $1}’|sort|uniq -c|sort -r

It will return a ranked list of your most commonly-entered commands using your command history.

Usefull Aptitude Commands

Usage: aptitude [-S fname] [-u|-i]
aptitude [options]
Actions (if none is specified, aptitude will enter interactive mode):

install – Install/upgrade packages
remove – Remove packages
purge – Remove packages and their configuration files
hold – Place packages on hold
unhold – Cancel a hold command for a package
markauto – Mark packages as having been automatically installed
unmarkauto – Mark packages as having been manually installed
forbid-version – Forbid aptitude from upgrading to a specific package version.
update – Download lists of new/upgradable packages
safe-upgrade – Perform a safe upgrade
full-upgrade – Perform an upgrade, possibly installing and removing packages
forget-new – Forget what packages are “new”
search – Search for a package by name and/or expression
show – Display detailed information about a package
clean – Erase downloaded package files
autoclean – Erase old downloaded package files
changelog – View a package’s changelog
download – Download the .deb file for a package
reinstall – Download and (possibly) reinstall a currently installed package
why – Show the manually installed packages that require a package, or
why one or more packages would require the given package
why-not – Show the manually installed packages that lead to a conflict
with the given package, or why one or more packages would
lead to a conflict with the given package if installed

Options:
-h This help text
-s Simulate actions, but do not actually perform them.
-d Only download packages, do not install or remove anything.
-P Always prompt for confirmation or actions
-y Assume that the answer to simple yes/no questions is ‘yes’
-F format Specify a format for displaying search results; see the manual
-O order Specify how search results should be sorted; see the manual
-w width Specify the display width for formatting search results
-f Aggressively try to fix broken packages.
-V Show which versions of packages are to be installed.
-D Show the dependencies of automatically changed packages.
-Z Show the change in installed size of each package.
-v Display extra information. (may be supplied multiple times)
-t [release] Set the release from which packages should be installed
-q In command-line mode, suppress the incremental progress
indicators.
-o key=val Directly set the configuration option named ‘key’
–with(out)-recommends Specify whether or not to treat recommends as
strong dependencies
-S fname Read the aptitude extended status info from fname.
-u Download new package lists on startup.
-i Perform an install run on startup.

This aptitude does not have Super Cow Powers.

Using the Clip Utility with Vista & WS2008

Both Vista and Windows Server 2008 have a cool utility “CLIP” which you can use to pipe or redirect the contents from a command line to the clipboard.

For example:
ipconfig /all | clip
netstat -ant | clip
dir /s *.pdf | clip

You can also redirect the contents of a text file to the clip board with:
clip

The clip utility can be handy for batch files or just gathering some details quickly and pasting them into a document.