You are on page 1of 10

Subject :- Unix Basics Prepared by :- Murali. M. Sr.

no 1 2 Question Text Level S S option a

root is Relative referencing means

the directory which doesnt have any parent directory Referring a file relative to the current directory

calendar command
S

displays calendar of the system month displays the result 15 The directory /

4 5

bc 5+10 Internal commands are located in To execute a Shell Script by specifying only name of script in the shell prompt, Statement A: The Shell Script should have execute permission for the concerned user. Statement B: The directory in which the Shell Script is located should be included as one of the directories in PATH variable.

S S

Statement A alone is sufficient.

For a program to get command status, The difference between the output of set command and env commands is that

set command displays unixdefined variables with their assigned values and env command displays user-defined variables with their assigned values

The value of the variable HISTFILESIZE determines


C

File size of each and every login user alias cp cp i a shell script Shell matches strings starting with one of the characters in character class. The working and output of these two commands is similar. A special file in /dev directory which incinerates the output redirected to it

9 10

The syntax of alias command in bash is If alias has to permanently reside in users login shell environment, user has to define aliases in When you precede a set of characters within a pair of square brackets by ! character, Assume there is a regular file called file1 in users current directory. Statement 1: cat file1 Statement 2: cat < file1 /dev/null refers to

M M

11

12

13

14

ls | tee filelist1 filelist2 /dev/tty | wc l The above piping sequence

C 15 16

echo $$ In the above command, $$ stores M When a command is issued in the shell prompt, the shell looks-up for the command M first in

Generates error message pid of the shell process, from which the above command is run Its own set of inbuilt functions

17 18 19 20 21

Daemons are ! variable stores _ variable stores . refers to To send a mail to a user using mail command, Assume there is a regular file called rhymes.txt in the users home directory ln rhymes.txt newrhymes When the user issues the above command from his home directory, Symbolic link can be defined between two files umask is System initial default permission setting for directory file is mv command

S M M C M

System initiated processes that run in the background pid of the last background process Exit status of a command Current directory The user should be on-line Value of number_of_links field is incremented by one only for the file rhymes.txt. That exists only in same file system. an external command 767

22

C C S S

23 24 25

26

renames a file

27

When we want to specify multiple patterns with grep command,


S

28

The meaning of the BRE * is

We can precede every such pattern by e option List of all the files in current directory

29

[-az] The above regular expression matches


M

Single occurrence of either a or a or z

30

A filter is
S

A shell built-in File permissions A pair of user-defined label Prevents accidental over-writing of an existing file These processes belong to a terminal called ? Shell displays error message Displays Mohan

31 32 33 34 35 36

Inode table for a file doesnt contain information about Delimiter for here document is set o noclobber When the user issues the command ps e, the ? in TTY column for certain processes denote that There is no variable called x in the environment of shell. When we type the command echo $x, name=Mohan expr $name read name User enters Mohan kumar What is stored in the variable name? Assuming there is a file called myfile.txt in users current directory, when the user issues the command sort < myfile.txt > myfile.txt

M M M C C S

37

Mohan kumar\n

38

Shell generates an error message

39 40 41 42 43

In vi program, G To customize vi environment and make the settings permanent, we need to make entries in For creating hierarchy of empty directories with mkdir command, printf is ls | who The above piping sequence echo There are `ls | wc l` files in the current directory In this command,

S M S S C

Refers to global switch $HOME/.bashrc We have to issue the option d an alternative to echo command Displays output of who command on the screen echo command is executed first and the echo command in turn executes the piping sequence ls | wc l Displays the long listing of files with the access time e option is the child of the sched process an external command bash: type: Command not found

44

C 45

ls lt
M

46 47 48 49

Issuing egrep command is equivalent to issuing grep command with init process awk is type echo When we issue this command, the output is

M M S S

option b

option c

option d

Answer

super users home directory which is under directory / Referring a file relative to parent of current directory

displays calendar of all the months of system year displays 5+10 .bash_profile

the directory that contains bootloader program Referring a file relative to the / directory displays all those lines that contain mention of sytem date and next date of system date in the file calendar in users home directory displays error message The shell

the directory that contains system b configuration files Referring a file relative to the a users home directory

None of these None of these .bash_history

c c c

Statement B alone is sufficient

Both Statement A as well as Statement B are necessary

Neither of them is required

set command customizes shell environment whereas env command displays environment variables with their values

both set command and env command displays unix defined environment variables with their values, and set command additionally displays user defined environment variables with their values and also user-defined functions. None of these

The maximum number of commands that can reside in the users shell environment in a particular login session of the user. alias cp i as cp .bash_history file in users home directory

The maximum number of commands that can reside in the file .bash_history in users home directory. alias cp=cp i .bashrc file in users home directory

The size of Unix History file. None of these None of these

c c c

Shell treats ! as ordinary character Shell negates the characters Both the commands give the same output, but their internal working The output produced by both is different. these commands is different. A special file in /dev directory A file that can be created by any which is accessible only to super user user.

c None of these Both the commands differ in their working as well as the output they b produce

None of these

Output of ls is stored only in filelist1, and wc l generates an output of 0. Exit status of a command PATH variable

tee receives through pipe, output of ls command, makes 4 copies, redirects 3 copies to files namely tee reads the contents of filelist1, filelist1, filelist2 and /dev/tty and stores in filelist2, /dev/tty and 4th copy is piped to wc l, which pipes to wc l and wc l sends its promptly processes and sends its d output to standard output file output to monitor. History of commands pertaining a Positional parameter variables to current login session Set of aliases that exist in the Set of user-defined functions that a shells environment exist in the shells environment

System initiated processes that run in the foreground pid of the current shell pid of current shell Internal command The user should have issued the command mesg y Value of number_of_links field is incremented by one for both the file rhymes.txt as well as newrhymes. That exists in different file systems also an internal command 777

User initiated processes that run in the background Exit status of a command pid of last run background job Exactly one occurrence of any character for grep command The user need not be on-line

System initiated processes that run in the foreground None of these last argument of the previous command All of these The user should be on-line and working on mail utility

a a d d c

Value of number-of_links field is Value of number_of_links field is incremented for neither of the incremented by one only for the b files. file newrhymes. Both of these a variable 666 renames or relocates based on the type of the destination file We can specify the multiple patterns separated by the ERE |, the expression preceded by E option. One or more occurrences of the preceding character an alias to a command 677
c b b

re-locates a file We can specify all the patterns in a file, specify the filename in place of pattern and precede the filename with f option Zero or more occurrences of the preceding character

None of these

All of these Zero or one occurrence of the preceding character

d b

Single occurrence of any character whose ascii value is less than a, or the character a or the Single occurrence of any character character z between a and z None of these a command when issued without any arguments, expects input from standard input file, processes the accepted input and sends processed output to standard a pipe output file None of these Number of links to the file A pair of curly braces Prevents from accidentally logging-out by pressing <ctrl-d> These processes run on the server that is independent of any Shell displays the prompt on the next line an error message, Displays bash: expr: Non-numeric argument Pointers to the data block A pair of ordinary parenthesis Prevents from clobbering of root directory by other users files Both of these Shell displays the prompt on the same line Displays null Name of file Do done None of these

c d a b

b None of these Shell displays the prompt leaving d a blank line in-between

Displays a blank line

Mohan kumar

Mohan A file called myfile.txt is created and the sorted contents of myfile.txt is re-directed to myfile.txt

Kumar\n

Sort generates an error message

File myfile.txt becomes empty file d

Takes cursor to the last line $HOME/.bash_profile We have to issue to option p

Takes cursor to the first line $HOME/.vimrc We have to issue the option e A command which supports format specifiers

Invalid command $HOME/.bash_history No option needs to be issued All of these None of these

b c b d b

is a shell in bash Output ofbuilt-in ls is piped to who which displays list of users and also the list of executes files in current The shell first ls | wc l, Generates error message places the output along with the argument to echo command and then transfers control to echo command.

Displays the output as There are `ls | wc l` files in current directory None of these Displays the long listing of files in Displays the long listing of files in the order of their modification the order of their access times times None of these E option has no parent an advanced filter echo is hashed to /bin/echo eg option ERE option

b a d c

is the root of the unix file system None of these has an interpreter echo is a shell builtin All of these None of these

You might also like