Archive for the ‘CLI’ tag

Watching the progress of a dd action

dd is one of those indispensable Unix / Linux utilities whether its cloning or wiping a drive or simply creating a bootable flash drive from an image file. The problem is operations like wiping a drive with the output from /dev/zero can take an extremely long time especially on larger hard drives. In situations like this it can be handy or somewhat soothing for the impatient to know how far through the requested action the process is.

Luckily its pretty simple to find out, simply open a new tab and execute:

pgrep -l ‘^dd$’

Read the rest of this entry »

leave a comment

June 22nd, 2012 at 10:36 am

Posted in Linux

Tagged with , ,

Quick Recursive Code Count

Although the “lines of code” in a project is not the worlds most useful metric. Curiosity sometimes gets the better of us and after many days / weeks of typing you think “gee I wonder exactly how many lines of code are in that project?”.

Wonder no more! By embracing the power of the command line you can easily count the lines in every file recursively. Simply execute the following line in the directory of your project (changing .php to the file extension of the files you would like to count the line of):

find . -name ‘*.php’ | xargs wc -l

Read the rest of this entry »

leave a comment

May 4th, 2012 at 3:18 pm

Posted in Linux,Programming

Tagged with ,