GeekInterview.com
Series: Subject: Topic:

Unix Programming Interview Questions

Showing Questions 1 - 20 of 45 Questions
First | Prev | | Next | Last Page
Sort by: 
 | 

How to launch 5 diff application from 5 child process

Asked By: pro_learner | Asked On: Mar 7th, 2013

Create a 5 child process from a common parent and launch different applications from the children processes....

What is the use of man command?

Asked By: janelyn | Asked On: Apr 16th, 2007

Answered by: Sonali Sehgal on: Jan 15th, 2013

man is also a UNIX command like ls or cat.I am also updating the UNIX a few examples for the man command. The POSIX specification requires man to support only one option (-k) and most of the UNIX syst...

Answered by: shivukinagi on: Nov 29th, 2009

This is the command where one can access the full book of help. man also resembles the manual or help for the user.

Print numbers in the reverse order

Asked By: pankajforall2003 | Asked On: Aug 12th, 2009

Write a shell script that accept any number of arguments and print them in the reverse order

Answered by: Sonali Sehgal on: Jan 14th, 2013

In PERL, we can reverse the string as follows:-

Code
  1. $x="12345678";

Answered by: Mihira Barik on: Dec 11th, 2009

This  the rt one ......#!/usr/bin/kshtypeset -i NUM=1234        //as u want typeset -i TMP_NUM=$NUMtypeset -i  REV=0while [ $NUM != 0  ]do  ...

How to write program to print descending order

Asked By: RoshanAshsih | Asked On: Jun 15th, 2011

Answered by: Sandhya.Kishan on: Jun 15th, 2012

Here is a program to print first n odd numbers in descending order

#include
main()
{
int i=0,j=0,n;
printf("Enter a number:");
scanf("%d",&n);
printf("The first %d odd numbers are:-
");
for(i=0;i<=n;i++)
{
if(j%2!=0)
printf("%d
"j);
j=j+1;
}
}

What is the method by which we find the list of users logged on a server using telnet service?

Asked By: nimish | Asked On: Aug 22nd, 2007

Answered by: ptmich on: May 25th, 2012

who | grep -c telnet | awk {print($1)}

Answered by: nareshbhatm on: Jan 6th, 2008

You can also use "finger"

What is inter-process communication facility?

Asked By: sripri | Asked On: Apr 16th, 2007

Answered by: Duc on: Oct 4th, 2011

Gopi mentioned the Unix socket, not TCP/IP or any kind of networking socket

Answered by: jsr.anur on: Dec 5th, 2008

Sockets won't come in Inter Process Communication.

Inter Process communication means communication between the processes with in the same system.

Sockets can communicate with the external systems

What are the benefits of creating links to a file?

Asked By: scott | Asked On: Apr 16th, 2007

Answered by: abdas on: Aug 1st, 2011

To make the file more secure, if the original file get deleted accidently, then the link will be available there.

Answered by: silambarasan_m on: Nov 28th, 2007

IPC also

How can you recognize a shell (c / korn / bourne) just by looking at the prompt?

Asked By: sreedevichandran | Asked On: Jun 7th, 2007

Answered by: abdas on: Aug 1st, 2011

There is no such way just by looking at the prompt as this is changable.

Answered by: jana05 on: Jan 15th, 2008

I dont think so just by looking at the prompt one can recognize the shell [inputs pls, if otherwise], however you can run small commands to get the shell that you are using
    ps -p $$

should be your answer.

What is the concept of named pipe?

Asked By: fred | Asked On: Apr 16th, 2007

Answered by: Kirthika J on: Jul 15th, 2011

Named pipe is FIFO.FIFO pipe create syntax is mknod() or mkfifo().Main thing in pipe,we cannot see the created pipe any where in the system.Named pipe is a file persistent.

Answered by: Masthan on: Jun 9th, 2007

Named pipe is nothing but FIFO

Logging script

Asked By: pankajforall2003 | Asked On: Aug 12th, 2009

Write a shell script that reports the logging in of a specified user within one minute after he/she logs in. The script automatically terminates if the specified user does not login during a specified period of time.

Answered by: Jyoti Ranjan on: Aug 4th, 2010

at command to execute the script at a specified timeDuration is assumesd as 150 minutesat -k -f log_chck -t 1008041555.00Contents of log_chck script #!/bin/ksh # Check if the user is logged ...

What is the use of sleep() function?

Asked By: sripri | Asked On: Apr 16th, 2007

Answered by: avinaspandey on: Jun 3rd, 2010

Sleep function can be used in the below scenario:1) Suppose you want to write the unix shell script which will keep on checking the arrival of a file in a particular directory in specified time, say e...

Answered by: avinaspandey on: Jun 3rd, 2010

The sleep() function will cause the calling thread to be suspended from execution until either the number of real-time seconds specified by the argument seconds has elapsed or a signal is delivered to...

Pipeline of commands

Asked By: pankajforall2003 | Asked On: Aug 12th, 2009

Write a pipeline of commands, which display on the monitor as well as save the information about the number of users using the system at present on a file called usere.Ux

Answered by: sham2sushil on: May 2nd, 2010

Use the tee command.

who | tee  -a
usere.ux

tee -a : display the o/p on monitor and save (append) in the file also.

--Shambhu

What is the command to find all of the files which have been accessed within the last one month?

Asked By: norman | Asked On: Apr 16th, 2007

Answered by: sham2sushil on: May 2nd, 2010

find / -atime -30 -print 2>/dev/null

2>/dev/null will discard all the error message. So it will list only the files

Answered by: suresh on: Aug 9th, 2007

find / -atime  -30

How to read and write of a open file?

Asked By: Sivaram | Asked On: Oct 30th, 2005

Answered by: sarikamagdum on: Nov 12th, 2009

Read from file:cat file_nameOr on terminal pagewise read as :more file_name.Write to file :echo "`cmd`" > file_name.Where cmd= any executable UNIX command.     &n...

Answered by: harish on: Dec 4th, 2006

we can use the read and write system call for thatread(fd,buff,BUF_SIZE);write(fd,buff,strlen(buff));assuming buff is a char string;

Find inode number

Asked By: pankajforall2003 | Asked On: Aug 12th, 2009

Create a program to find out the inode number of any desired file

Answered by: Akshayenehra on: Sep 20th, 2009

read fname     #file name to be searched.

p=`pwd`
cd /
l=`find -name $fname`
l=`echo $l | ls -i`
set $l
echo "inode is $1"
cd $p



Find smallest of 3 numbers

Asked By: pankajforall2003 | Asked On: Aug 12th, 2009

Write a shell script to find the smallest of three numbers that are read from the keyboard.

Answered by: goksn on: Sep 7th, 2009

echo first_numread first_numecho second_numread second_numecho third_numread third_numif (first_num>second_num) then if (first_num>third_num) then echo $first_num is the biggest e...

What are the steps for locking a file?

Asked By: timmy | Asked On: Apr 16th, 2007

Answered by: Rohit_Ash on: May 27th, 2009

We can use chmod *** dir_name
Where *** are permissions.

Answered by: shobhitcs on: Jan 17th, 2008

how can we add stick bits in unix file system suppose a file name with abc....how will u add any sticky bit in that because control is not working in this case .....

Write a korn shell script for renaming the filenames of the files stored in a folder to lower case.

Asked By: renjiraj | Asked On: Nov 9th, 2007

Answered by: Rohit_Ash on: May 27th, 2009

Tested script.

#! /usr/bin/ksh
echo "start"
for name in `ls -1`
do
echo "name $name"
name1=`echo $name | tr [A-Z] [a-z]`;
echo "name1 $name1"
mv $name $name1;
if [ -z $name ]
then
exit;
fi
done

Answered by: ENIAC on: Feb 23rd, 2009

#!/bin/gawk -f## LowerFiles.gawk## Using GAWK, we can strip off the file name from the full path, #    and rename it only when necessary (skip files that are already lowercase.)# U...

What is the UNIX command to wait for a specified number of seconds before exit

Asked By: arvind_kumarmca | Asked On: Oct 31st, 2007

Answered by: Rohit_Ash on: May 27th, 2009

This is easiest way:

sleep seconds

Answered by: UncaAlby on: Nov 7th, 2008

sleep specified number of seconds
exit

What is difference between process and a job ?

Asked By: dinesh | Asked On: Jul 20th, 2007

Answered by: rajani.vdeshpande on: May 5th, 2009

A process is a program in execution. And a Job is a task.

Answered by: kARUNA on: Jul 23rd, 2007

Process is nothing but excution in program wheare as job is any task or work.

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.