UNIX objective questions for freshers

1. what will cat foo foo foo display?

2. to append .c to a variable x, you have to use
a.) echo $x.c
b.) echo $x”.c”
c.)echo ${x}.c
d.) none of these
e.) any of these

3. if TERM has the value vt220, where will you expect to find its control file?

4. find out the no. of words in this string as interpreted by a) vi and b) wc:
” 29.02.2000 is_last_day_of_febuary”
5. $a = 5
b=a
echo $b
what is will display?

what is the output of the follwing command : ls [a-mno-r]*
answer :
list all the files in the current directory where starting alphabet
is between a to m inclusive or m or between o to r

what is the mkdir -p option used for
answer :
mkdir -p dirpath
creates all the directories in the path which do not exist.

what are the minimum number of links directory can have
answer : 2

How are the devices treated in Unix
answer : files

what does(-)before the permissions of file in long listing signify
answer : ordinary files

Q1) Can an alias be exported to the subshells?
Ans) No. An alias is local only to the shell in which it was declared and
is lost once you logout.

Q2) What are the different security features in Unix?
Ans)
1. Password protection.
2. File permissions.
3. Encryption.

Q3) Write a one line command to convert all the capital letters of a file “test” into lower case?
Ans)dd if=test of=temp conv=lcase && cat temp

Q4) What are the commands used to control the flow of commands when they are given in a single line

Ans)

1. $ &&
command2 is executed only after command1 is executed.
2. $ ||
command2 is executed independently without depending on the result of the first command

Q5) Write the output of the following commands ?

1. echo `this is a new file $1`
ans. ksh: this: not found
2. echo ‘this is a new file $1’
ans. this is a new file $1
3. echo “this is a new file $1”
ans. this is a new file
$ set how r u my friend
4. echo “this is a new file $1”
ans. this is a new file how
1)what is the output of the following command : echo \***
answer : ***

the contents of a file named file1 are as follows
a
ab
aab
b
b

2)what is the output of the follwing command : grep a* file1
answer :
a
ab
aab

3)what is the output of the following command : grep “a*” file1
answer:
a
ab
aab
b
b

4)what is the output of the following command : ls *
answer : it gives the all the files that are there in the directories and sub directories( not in the sub sub directories)

5)can a user modify the contents of a file if the sticky bit is on for the directory in which the file resides
answer : no

6)what is mkdir -m command used for ?
usage :
mkdir -m 777 newdir :assigns the rwx permissions to all irrespective of the umask value.

7)Given a pid how can I tell if its a running program using the kil command?
answer : kill -0 PID
no message at the output implies that a process exists with the given PID, and therfore the system allows you to send signals to it.

8)what does ctrl-z do to a running process
answer :
the process is stopped.

9)what is the mkdir -p option used for
answer :
mkdir -p dirpath creates all the directories in the path which do not exist.

10)can a directory have more than 2 links
answer .yes

11)what happens in case a command in a group of commands given at the shell prompt fails?
answer a) it continues with executing the rest of the commands
b) stops executing .
answer:b

If you have questions, please ask below

Leave a Reply

If you have any questions headover to our forums

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>