14 March 2014

Basic Linux MCQ Questions for Beginners (Linux Processes) - Set 6

568 comments

linux Question and answer in linux
This is set 6 in the ongoing series of MCQ. Hope you have enjoyed the other parts of the series. In this set we will cover questions related to Linux processes as processes are fundamental part of the Linux system. So lets get started

1

What is ppid(parent process id) of daemon process in Linux ?

any arbitrary number

1

Answer
Option B is correct, As daemon process are initiated by init process(Pid is 1). You can see all your system daemon process by running following command
$ cd /etc/init.d && ls
See all your currently running daemon process by executing following command
$ ps -ef | awk '$3 == 1'
Read More...

07 March 2014

Starting with Django in Ubuntu - Installation

15 comments

Installing django in UbuntuHi Guys, Today we are going to setup our Ubuntu system for Django Development, as you all know that Django is a free and open source web application framework, written in Python, which follows the model–view–controller architectural pattern. Django's installation is somewhat tricky for beginners as it required many things to take care of. Don't worry, In this post I will cover each and every thing that required for Django installation and I will guide you, how to set up your first project in Django . So lets get started.


How to Install Django in Ubuntu


Step 1. Install pip : pip is a package management system used to install and manage software packages written in Python. It is prefered over easyinstall in python. You can read more about pip from Here.

$ sudo apt-get install python-pip
Read More...

17 January 2014

Google Chrome 32 Released with Supervised users , Noisy Tab detection and better Malware Protection feature! Install it Ubuntu/Linux Mint

5 comments

Google-chrome is a cross-platform web-browser which runs on any platform whether it is mac , linux or windows. The main reason for the popularity of google-chrome is that it runs web-page and application with lightning speed .

Recently Google has announced the release of Google Chrome 32, its latest stable version for Linux , Mac and Windows. Google Chrome 32 comes with some new feature and fixes some of the features included like supervised user , detecting noisy tabs , better malware detection and prevention etc. For more information you can see the Complete Changelog

New in Google Chrome 32

  • Tracking Noisy Tabs: This feature allows you to visually scan your tabs for a speaker icon to quickly find the ones singing in the background. You’ll also be able to see which tabs are currently using your webcam or are being cast to your TV.
  • Safe Browsing's malware warning has gotten stronger
  • Supervised User

For More Information about above three points Read Here.
Read More...

12 January 2014

Shell Script to print Pyramid of Numbers

21 comments


Q. How do I print pyramid of numbers in Bash


Ans.
how to print number pyramid in ubuntu

Before writing bash script lets understand how we going to print this pattern. We do it in two part, first we are going to print part 1 and then we print the part 2. As you can notice from above figure that, in 2nd part we are printing number in reverse order till 1.

#!/bin/bash

#Taking input
read -p "Enter Number:" number

#Outer loop for printing number of rows in pyramid
for((row=1;row<=number;row++))
do

    #Loop for printing required spaces
    for((spaces=row;spaces<=number;spaces++))
    do
        echo -ne " "
    done

    #Loop for printing 1st part
    for((j=1;j<=row;j++))
    do
        echo -ne "$j"
    done

    #Loop for printing 2nd part
    for((l=(row-1);l>=1;l--))
    do
        echo -ne "$l"
    done

    #echo for printing new line
    echo 
done
    
Read More...

05 January 2014

Basic Linux MCQ Questions for Beginners- Set 5

6 comments

linux Question and answer in linux
This is set 5 in the ongoing series of MCQ. Hope you have enjoyed the other parts of the series. In this set also, I will cover some more basic Linux questions and their answer. Hope you will like it.

1

Which of the following commands are used to display last 10 line of the file?

tail filename

tail -10 filename

Both A and B

Only B

Answer
Option C is correct, By defualt tail command displays last 10 lines of a file, So command A and B are same.
Read More...

22 October 2013

How to install Xdebug with Sublime Text in Ubuntu 12.04

15 comments

Xdebug is a PHP extension for powerful debugging. It supports stack and function traces, profiling information and memory allocation and script execution analysis. Xdebug provide following functionality like function name, file name and line indications, support for member functions, full parameter display for user defined functions etc for PHP developers which help them to debug their code easily and quickly.

Installing Xdebug with Sublime Text in Ubuntu is little bit tricky, but you can easily install it if you follow along this post. Lets get started.

Installing Xdebug in Ubuntu

Step 1: Open terminal(Ctrl + Alt + t) and type following command to see whether Xdebug is installed or not.
$ php -v
PHP 5.3.10-1ubuntu3.8 with Suhosin-Patch (cli) (built: Sep  4 2013 20:00:51) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
Note: If your Output is same like mine then you are good to go. If not the type following command to install it.
$ sudo apt-get install php5-xdebug
Read More...

02 August 2013

Shell Script to print pyramid of Stars

81 comments

Q. How do I print pyramid of stars using function in Bash


Ans.

bash script to print pyramid of stars
Before writing bash script lets understand how we going to print this pattern. We do it in two part, first we are going to print part 1 and then we print the part 2.

#!/bin/bash
makePyramid()
{
  #Here $1 is the parameter you passed with the function i,e 5
  n=$1;

  #outer loop is for printing number of rows in the pyramid
  for((i=1;i<=n;i++))
  do

      #This loop print spaces required
      for((k=i;k<=n;k++))
      do
        echo -ne " ";
      done

      #This loop print part1 of the the pyramid
      for((j=1;j<=i;j++))
      do
      echo -ne "*";
      done

      #This loop print part 2 of the pryamid.
      for((z=1;z<i;z++))
      do
      echo -ne "*";
      done
      
      #This echo used for printing new line
      echo;
  done
}

#calling function

#change number according to your need
makePyramid 5

Read More...