Find Interview Questions for Top Companies
Ques:- write a shell script that accepts name from user and creates a directory by the path name, then creates a text file in that directory and stores in it, the data accepted from user till STOP, displays the no. of characters stored in the file.Program stops if directory name is null
Asked In :-
Comments
Admin May 17, 2020

#!/bin/bash
echo -n "Enter directory name:"
read x
[[ ${x:='xX'} == 'xX' ]] && echo "error: No filename" &&
exit 0
mkdir --parents "/tmp/$x" 2> /dev/null
echo -n '' > "/tmp/$x/$x.txt"
echo "Enter text. Type 'STOP' on a line by itself to terminate."
while read y
do
[[ "$y" == "STOP" ]] && break;
echo "$y" >> /tmp/"$x"/$x.txt
done
a=$(wc -c "/tmp/$x/$x.txt" | cut -f1 -d' ')
echo
echo "file: /tmp/$x/$x.txt has $a characters"
exit 0;

Ques:- c program which accept one argument as a directory name and prints all the file name along with its inode number and total count of the file in directory
Asked In :-
Comments
Admin May 17, 2020

#include <stdio.h>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <stddef.h>
#include <sys/stat.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
DIR *dip;
struct dirent *dit;
struct stat sb;
int i = 0;
if(argc < 2)
{
printf("Usage: %s <directory>n", argv[0]);
return 0;
}
if((dip = opendir(argv[1])) == NULL)
{
perror("opendir");
return 0;
}
printf("Directory stream is now openn");
while ((dit = readdir(dip)) != NULL)
{
i++;
stat(dit->d_name,&sb);
printf("%u t%sn",sb.st_ino,dit->d_name);
}
printf("No. of Files in directory are: %i n", i);
if(closedir(dip)== -1)
{
perror("closedir");
return 0;
}
printf("nDirectory stream is now closedn");
return 1;
}

Ques:- c program the catches the ctrl-c(SIGINT) Signal for the first time and prints a output rather and exit on pressing Ctrl-C again
Asked In :-
Comments
Admin May 17, 2020

#include <stdio.h>
#include <signal.h>
void sigproc(void);
main()
{
signal(SIGINT, sigproc);
printf("This program catches ctrl-c(SIGINT) signal for
first time and exit on pressing ctrl-c againn");
for(;;);
/* infinite loop */
}
void sigproc()
{
signal(SIGINT, sigproc);
printf("you have pressed ctrl-c n");
(void) signal(SIGINT,SIG_DFL);
}

Admin May 17, 2020

on Linux:
man 2 signal
for signum use SIGINT

Ques:- c program to check whether all the directories in the path exists has read and write permission
Asked In :-
Comments
Admin May 17, 2020

#!/bin/bash
for x in $(echo $PATH |sed "s/:/ /g")
do
echo "Directories in your PATH which you cannot write are:"
echo $(find $x -perm /666 -type d -maxdepth 0 2>/dev/null
|xargs ls -dl | grep -v $USER)
done
exit 0;

Ques:- c program which behaves like a shell(command interpreter). it has its own prompt say “NewShell$”.any normal shell command is executed from your shell by starting a child process to execute a system program corrosponding to the command
Asked In :-
Ques:- c program to display the information of given file similar to givan by the unix or linux command ls -l
Asked In :-
Ques:- c program to implement unix/linux command to block the signal ctrl-c and ctrl- signal during the execution ls -l|wc -l
Asked In :-
Ques:- I Forgot My Windows Vista Password! How Can I Find My Windows Lost Password?
Asked In :-
Ques:- write a shell program to check wheather a given string is pallindrome or not?
Asked In :-
Comments
Admin May 17, 2020

this script is written for bash :
echo Enter the string
read s
echo $s > temp
rvs="$(rev temp)"
if [ $s = $rvs ]
then
echo "it is palindrome"
else
echo " it is not"
fi

Admin May 17, 2020

echo Enter the string
read s
echo $s > temp
rvs="$(rcs temp)"
if [ $s = $rcs ]
then
echo "it is palindrome"
else
echo " it is not"
fi

Ques:- Explain how you Automate your application using Shell scripting.
Asked In :-
Ques:- write a shell script to check whether all the directories in the path exist has read and write permission
Asked In :-
Comments
Admin May 17, 2020

#!/bin/bash
for x in $(echo $PATH |sed "s/:/ /g")
do
echo "Directories in your PATH which you cannot write are:"
echo $(find $x -perm /666 -type d -maxdepth 0 2>/dev/null
|xargs ls -dl | grep -v $USER)
done
exit 0;

Ques:- How can I Debug a shell scripts and Perl scripting?? or How do you debug a shell scripting and perl scripting ( at the compile time error or run time error) in Unix environment ?
Asked In :-
Comments
Admin May 17, 2020

Using sh -x script argument you can debug(-x option).
Bash shell offers debugging options which can be turn on or
off using
set command.
=> set -x : Display commands and their arguments as they are
executed.
=> set -v : Display shell input lines as they are read.
Hope this answers your question.

Admin May 17, 2020

We can debug only by $? which contains the returned value
of last executed command.
If $? contains 0 value then command run successfully other
wise error occured while running command

Ques:- How to handle the delimiter unit seperator in Unix
Asked In :-
Comments
Admin May 17, 2020

create script test.txt with | seperated
The below commands can be used to get the fields values:
awk -F"|" '{print $1}' test.txt
cat sri.txt | cut -d"|" -f1

Admin May 17, 2020

Different types of command using delimiter :
1. cut -d "|" -f6 emp.lst
d : delimiter or field separator
2. sort -t "|" -nk6 emp.lst
t : delimiter or field separator
3. awk -F "|" '{print $6}' emp.lst
F : delimiter or field separator

Ques:- I have to write Shells (Linux + Unix)for publishing packages and reports. Is it possible ? What are the differents executable programs ineed to call ?
Asked In :-
Ques:- how did u debugging in unix/ linux platform ??( project Related)
Asked In :-
Comments
Admin May 17, 2020

For gdb in linux/unix Gnu Debugger is available. Please
read the mannuals for gdb.
man gdb

Admin May 17, 2020

If it is a shell script use #!/bin/ksh -x

Ques:- If one dont know how to create a script then how he/she can use the QTP?
Asked In :-
Comments
Admin May 17, 2020

use record/playback feature but won't be able to go too far
with it

Ques:- Write a shell script to looking at the log file to see if the test has passed or not
Asked In :- Orion Innovation,
Comments
Admin May 17, 2020

test -f $(find /var/log/messages -name "file.log" )
echo $?
If it returns 0 means passed
if 1 means not passed

Admin May 17, 2020

tail -f /var/log/messages provided all the messages are
appended to the log.

Ques:- Why we are writting shell scripts? Plz if possible explain it briefly.
Asked In :-
Comments
Admin May 17, 2020

1>Interactive mood:--
As Shell scripting is working like as interpreter (not
likely compiler) in a interactive mood.
2> Less time:--
it will take less time than C or C++ or other file to process.

Admin May 17, 2020

Shell is a command interpeter. If we want to run multiple
commands at a time through a script file then it is called
shell scripts.
Generally we will write these to set certain environmental
variables in unix and run some other programs.
The shell scripts utility programs to perform certain tasks
in unix environment.

Ques:- Hi Friends, I am currently Undergoing Course On Testing.I am Planning To Keep Fake Resume.Can any One tell me the ways to Prepare i.e, Real Time experience For Manual Testing. With Regards, Vikram
Asked In :-
Comments
Admin May 17, 2020

this site is for knowledge sharing friend. not for fake
things. use this site as it meant for.

Ques:- what do u mean by $#,$* in unix programming?
Asked In :-
Comments
Admin May 17, 2020

$# - Number of argument passed
$* - Array of arguments given (or) passed arguments as an array

Admin May 17, 2020

$# - number of command line arguments or positional
parameters
$* - All of the positional parameters, seen as a single word



The Unix category on takluu.com is designed for IT professionals and developers preparing for interviews that require a strong understanding of Unix operating systems. Unix has been the backbone of many enterprise systems due to its stability, security, and multitasking capabilities.

This section covers key topics such as Unix file system architecture, shell scripting, process management, file permissions, user management, and networking commands. You will also learn about vi editor, cron jobs, package management, and system monitoring tools.

Interview questions often assess your proficiency in writing shell scripts, automating tasks, troubleshooting system issues, and managing user permissions. Candidates may be tested on commands like grep, awk, sed, find, and piping techniques, as well as understanding system boot processes and kernel basics.

Roles such as Unix Administrator, DevOps Engineer, System Engineer, and Backend Developer often require expertise in Unix environments. This category also includes best practices for security hardening, backup strategies, and performance tuning in Unix systems.

At Takluu, we offer detailed tutorials, practical exercises, and interview question sets that will help you build confidence and excel in your Unix-related interviews.

Whether you’re a beginner or looking to deepen your Unix skills, this category equips you with comprehensive knowledge to manage Unix systems efficiently and advance your career.

AmbitionBox Logo

What makes Takluu valuable for interview preparation?

1 Lakh+
Companies
6 Lakh+
Interview Questions
50K+
Job Profiles
20K+
Users