Monday, June 12, 2006

Process background and foreground

To run a process in the background, we normally use
$ command &
What if we accidentally start a process in the foreground instead of starting it in the background? No problem. Just do a
CTRL+Z
and the process will jump to the background. Note that pressing a
CTRL+Z
will move the process to the background and suspend it. In order for it to keep executing, you need to do a
CTRL+Z
and then type
bg
to keep it running the background. Now, you can type
jobs
to see the list of processes running the background. To bring a particular job to the foreground, type
fg 

MrProper

I was cleaning up an old version of the kernel and I came across this command
 make mrproper 

Curiosity got the better of me, and I went ahead googling and fell on a forum thread discussing the origin of the “mrproper”. After “analysis", it was found and confirmed that mrproper stands for “Meister Proper” (German) or Mr. Clean , a cleaning liquid product.

Hmmmm……

Creating a patch in Linux

diff -C 4 orig_file.c new_file.c >myfile.patch 

Here the “C 4″ specifies to add a 4 line context to understand where the patch fits for the user. To apply the patch, copy the file to the directory where the patch needs to be applied and execute the following command. Here, the p0 specifies to take the filename only and not the entire path which will be specified in the patch file


patch -p0 < myfile.patch

Recursive Download

For downloading only a particular type of files (say, *.pdf) form a http link, i used the following commands in sequence First, I downloaded the page containing the links to all the pdf files (ok, point to note here; I was not able to download recursively because of the robots.txt restriction)


wget http://my.requiredsite.com/page1/download/

This created a index.html file in the current directory for me with relative links to all pdf files. Then,
wget -r -nd -np -l4 -A "*.swf" -F -i ./index.html --base=
http://my.requiredsite.com/page1/download/
to download only the pdf files from the site.