0% found this document useful (0 votes)
54 views

UNIX Question Bank

The document provides explanations and examples of various UNIX/Linux commands and concepts: 1. It explains the four layer structure of the UNIX operating system - hardware, kernel, shell commands, and application layer. 2. It differentiates between internal and external commands, and provides the 'type' command as a way to check if a command is internal or external. 3. It lists some key features of UNIX like being multi-user, providing multitasking, portability, hierarchical file structure, and built-in networking. 4. It provides examples of various commands like ls, cat, tac, mv, rm, cp, cd, mkdir, rmdir, and explains what each command is
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

UNIX Question Bank

The document provides explanations and examples of various UNIX/Linux commands and concepts: 1. It explains the four layer structure of the UNIX operating system - hardware, kernel, shell commands, and application layer. 2. It differentiates between internal and external commands, and provides the 'type' command as a way to check if a command is internal or external. 3. It lists some key features of UNIX like being multi-user, providing multitasking, portability, hierarchical file structure, and built-in networking. 4. It provides examples of various commands like ls, cat, tac, mv, rm, cp, cd, mkdir, rmdir, and explains what each command is
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.Explain the structure of UNIX OS.

ANS:-Layer-1: Hardware –
It consists of all hardware related information.
Layer-2: Kernel –
The kernel is the heart of the operating system. It interacts with the
hardware and
most of the tasks like memory management, task scheduling and file management.
Layer-3: Shell commands –
The shell is the utility that processes your requests. When you type in a
command at
your terminal, the shell interprets the command and calls the program that you
want.
The shell uses standard syntax for all commands. C Shell, Bourne Shell and
Korn Shell
are the most famous shells which are available with most of the Unix variants.
Layer-4: Application Layer –
It is the outermost layer that executes the given external applications.

2.Diffentiate between external and internal commands.How do you find wheather a


command is internal or external.
ANS:-Internal Command:Internal commands are something which is built into the
shell. For the shell built in commands,
the execution speed is really high. It is because no process
needs to be spawned for executing it.
For example, when using the "cd" command, no process is
created. The current directory simply
gets changed on executing it.
External Command:External commands are not built into the shell. These are
executables present in a separate file.
When an external command has to be executed, a new process
has to be spawned and the command gets executed.
For example, when you execute the "cat" command, which
usually is at /usr/bin, the executable /usr/bin/cat gets executed.
Checking weather it is an internal or external command:-
$ type cd
Cd is shell built-in
$ type cat
Cat is /usr/bin/cat

3.Compare UNIX and LINUX.

4.Explain the features of UNIX OS.

ANS:-Multiuser:It is a multi-user system where the same resources can be shared by


different users.
Multitasking:It provides multi-tasking, wherein each user can execute many
processes at the same time.
Portability:It was the first operating system that was written in a high-level
language (C Language).
This made it easy to port to other machines with minimum
adaptations.
It provides a hierarchical file structure which allows easier access and
maintenance of data.
Unix has built-in networking functions so that different users can easily
exchange information.
Machine independent, Security, Pipes and filters, Unix shell programming
5.What is the difference between rm and rmdir.

6.Expain the following commands with syntax and example.


ls-Lists Content of the directory.eg-$ls
cat-Creates a new text document.eg-$cat > filename.txt
tac-Opens the given text document.eg-$tac filename.txt
mv-moves one or more files or directories from one place to another.eg-$mv
OPTION...-T SOURCE DEST
rm-Deletes an old Document.eg-$rm filename
cp-to copy any text.
cd-to change the folder directive.eg-$cd directory name
mkdir-to create a new directory.eg-$mkdir directory name
rmdir-removes a directory.eg-$rmdir directory name
cmp-It is used to compare the two files byte by byte and checks
whether the two files are identical or not.
eg-$cmp-l-s file1 file2
sort-It is used to rearrange the contents of text files line by line.
eg-$ sort -r fruits.txt -o fl.txt
comm-comm compare two sorted files line by line and write to
standard output; the lines that are common and the lines that are unique.
eg-$comm -123 file1 file2
echo-to print the written message.
eg-$echo -n string
printf-It is an internal command.It requires new line character when data needs
to be printed
on new line.It works the same way as in C language.
eg-$printf formate argument
wc-to count the no of word, no of lines and no of characters.
eg-$wc options file
date-displays the current date and time.
eg-$date
cal-displays the whole cal until specifed a particular month.
eg-$cal
tee-tee command reads the standard input and writes it to both
the standard output and one or more files.
eg:-$ tee bye.txt
hello
hello
bye
bye
grep-finding a particular string in a file.
touch- The ‘$ touch’ command creates a file(not directory) and
you can simple add an extension such as .txt after it to make it a Text
File.
pwd-prints the directory in which we are currenctly working.
file-it displays the type of file.eg:-$ file helloworld
helloworld: ASCII text
tail-displays the end of an file.
ipconfig-displays the internet configuration of the device.
df-used to display the amount of available disk space for file system.
history-displays all the commands written and executed.
man-it is used to display the user manual of any command that we can run on the
terminal.

Chapter 1-2-5
1.Explain if-else-if with syntax and example.
ex-
2.Explain while loop with syntax and example.
ex-Display numbers from 1 to 10.
number = 1
while [ $number –lt 11 ]
do
echo $number
((number++))
done

3.Explain for loop with syntax and example.


ex-Display names from a list.

for p_name in Stan Kyle Cartman


do
echo $p_name
done

You might also like