What is the method by which we find the list of users logged on a server using telnet service?
What is inter-process communication facility?
Gopi mentioned the Unix socket, not TCP/IP or any kind of networking socket
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?
To make the file more secure, if the original file get deleted accidently, then the link will be available there.
IPC also
How can you recognize a shell (c / korn / bourne) just by looking at the prompt?
There is no such way just by looking at the prompt as this is changable.
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?
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.
Named pipe is nothing but FIFO
How to write program to print descending order
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.
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?
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...
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...
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
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?
find / -atime -30 -print 2>/dev/null
2>/dev/null will discard all the error message. So it will list only the files
find / -atime -30
Print numbers in the reverse order
Write a shell script that accept any number of arguments and print them in the reverse order
This the rt one ......#!/usr/bin/kshtypeset -i NUM=1234 //as u want typeset -i TMP_NUM=$NUMtypeset -i REV=0while [ $NUM != 0 ]do ...
Here you go .. set NUMBER=1234 // Pass the number as you want .set REV=0 set TMP_NUM=$NUMBERwhile [ $NUMBER != $REV ]do RMND = $TMP_NUM % 10 &n...
What is the use of man command?
This is the command where one can access the full book of help. man also resembles the manual or help for the user.
To display help text for a Unix command from the Unix system manual.
How to read and write of a open file?
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...
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;
Create a program to find out the inode number of any desired file
read fname #file name to be searched.
Write a shell script to find the smallest of three numbers that are read from the keyboard.
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?
We can use chmod *** dir_name
Where *** are permissions.
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.
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
#!/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
What is difference between process and a job ?
A process is a program in execution. And a Job is a task.
Process is nothing but excution in program wheare as job is any task or work.
A zombie process is a process that completed execution but still in process table. When a process ends, all of the memory and resources associated with it are deallocated so they can be used by other ...
A zombie is a process whose parent has exited but the child has not.
who | grep -c telnet | awk {print($1)}
You can also use "finger"