Unix/Linux Shell Programming and Commands

Test your knowledge of Unix/Linux shell scripting variables, functions, and basic operating system commands

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

What is VI?

  1. A text editor
  2. The UNIX telnet service
  3. An E-mail client
  4. An FTP client
Question 2 Multiple Choice (Single Answer)

How do you create a new directory called "flower"?

  1. newdir flower
  2. mkdir flower
  3. crdir flower
  4. makedir flower
Question 3 Multiple Choice (Single Answer)

What command do you have to use to go to the parent directory?

  1. cd ..
  2. cd /up
  3. cd -
  4. cd ~
Question 4 Multiple Choice (Single Answer)

With what command you can see what folder you are in?

  1. whereami
  2. map
  3. place
  4. pwd
Question 5 Multiple Choice (Single Answer)

With what can you stop a process?

  1. Shutdown
  2. stop
  3. kill
  4. delete
Question 6 Multiple Choice (Single Answer)

With what command you can see your user name?

  1. I
  2. me
  3. whoami
  4. pwd
Question 7 Multiple Choice (Single Answer)

The Command :>filename is used to

  1. Empty the existing file or create an empty file
  2. Print the string : to filename
  3. Delete the file
  4. Append the file at the last line
Question 8 Multiple Choice (Single Answer)

The Default variable $TZ is used to[wrong]

  1. display the number of Zombie process in the system
  2. set the time zone
  3. set the time for zip process
  4. display the last test condition result
Question 9 Multiple Choice (Single Answer)

filename=sample.txtfile=${filename%.*}echo $file$file now contains

  1. txt
  2. sample
  3. .txt
  4. sample.
Question 10 Multiple Choice (Single Answer)

How to call the function function1 in shell

  1. function1()
  2. call function1
  3. function1
  4. ask function1
Question 11 Multiple Choice (Single Answer)

The Command :>filename is used to

  1. Empty the existing file or create an empty file
  2. Print the string : to filename
  3. Delete the file
  4. Append the file at the last line
Question 12 Multiple Choice (Single Answer)

The Default variable $TZ is used to

  1. display the number of Zombie process in the system
  2. set the time zone
  3. set the time for zip process
  4. display the last test condition result
Question 13 Multiple Choice (Single Answer)

filename=sample.txt file=${filename%.*} echo $file $file now contains

  1. txt
  2. sample
  3. .txt
  4. sample.
Question 14 Multiple Choice (Single Answer)

How to call the function function1 in shell

  1. function1()
  2. call function1
  3. function1
  4. ask function1
Question 15 Multiple Choice (Multiple Answers)

What are the ways to get the filename from the absolute path in a variable Mypath=/my/path/file

  1. filename=basename Mypath
  2. filename =file Mypath
  3. filename = ${Mypath#/*/*/}
  4. echo \$Mypath | awk ‘ FS=”/” { print \$4 } ‘
Question 16 Multiple Choice (Single Answer)

Which variable contains the return value of last executed command

  1. $!
  2. $?
  3. $#
  4. $@
Question 17 Multiple Choice (Single Answer)

which operator is used for testing condition

  1. check
  2. test
  3. expr
  4. find
Question 18 Multiple Choice (Single Answer)

Which variable holds the values of command line parameters

  1. $#
  2. $*
  3. $@
  4. $?
Question 19 Multiple Choice (Single Answer)

which variable holds the number of values of comman line parameters

  1. $#
  2. $*
  3. $@
  4. $?
Question 20 Multiple Choice (Single Answer)

ksh shell was developed by

  1. Korn Matt
  2. Karthick Subramanian
  3. David Korn
  4. Kandasamy