Unix/Linux Operating System Commands

Test your knowledge of Unix/Linux operating system commands, shell scripting, process management, and system administration tasks.

14 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

I have a script named test.sh and the contents are as follows: $ cat test.sh echo hi rm -f test.sh echo hi ######## What will be the output of the following comand: $ sh test.sh

  1. the first 'hi' will be displayed but it will say "Could not delete file: in use" and will exit the script
  2. the first 'hi' will be displayed but it will say "Could not delete file: in use" and will then echo the second 'hi'
  3. The script will display 2 'hi' and the file will also be deleted
  4. The first 'hi' will be displayed, the script will be deleted , but the 2nd 'hi' will not be displayed.
Question 2 Multiple Choice (Single Answer)

I have a file named "-p" in my home directory. Which of the following commands will be used to delete this file?

  1. rm -p
  2. rm -f -p
  3. rm -f -- -p
  4. rm -f "-p"
Question 3 Multiple Choice (Single Answer)

I want to change the date of my linux server to 'Mon Nov 23 18:08:07 IST 2009'. Which of the following commands wil help?(ignore the seconds in the date)

  1. a) date 1123180809
  2. b) date 2311180809
  3. c) date -s "Mon Nov 23 18:08:07 IST 2009"
  4. d) Both a and c
Question 4 Multiple Choice (Single Answer)

A script is executing since last 10 minutes and is expected to take another 10 minutes. So I decide to send it to background. Which of the following steps will do it?

  1. Press Ctrl-Z and type "bg"
  2. Press Ctrl-D and type "bg"
  3. Open a new termial and type "bg <pid>" where <pid> is the pid of that script
  4. None of these
Question 5 Multiple Choice (Single Answer)

I want to send a file as an attachment to my mailserver from my unix server using mailx. Which of the following will help me create the file as attachment?

  1. uuencode coomand
  2. attach command
  3. compress command
  4. Its not possilble to send attachment from unix
Question 6 Multiple Choice (Single Answer)

What is the output of the following command in bash shell on Linux? $ i=2 $ [ $i -lt 2 ] || echo great

  1. great
  2. no output
  3. test: syntax error
  4. we will have to export the value of i
Question 7 Multiple Choice (Single Answer)

Find the output of the last echo command: $ pwd /home/guest $ cat test.sh export i=100 $ sh test.sh $ echo $i

  1. 100
  2. blanck line
  3. No such variable $i
  4. None of these
Question 8 Multiple Choice (Single Answer)

What is the output of the following command? $ cd -

  1. change to home directory
  2. change directory to last directory as saved in the environment variable OLDPWD
  3. move to the last directory of that structure
  4. None of these
Question 9 Multiple Choice (Single Answer)

The password of an unix user can be changed by the following command:

  1. passwd
  2. passwd and pwdadm
  3. pwdadm
  4. password
Question 10 Multiple Choice (Single Answer)

What does this command show? $ echo $TZ

  1. The DayLight Saving Time
  2. The Time zone
  3. blanck line
  4. You will have to set the value of TZ variable first
Question 11 Multiple Choice (Single Answer)

What is the advantage of grep over awk with reference to decision-making scripts?

  1. grep shows different values for $? while awk always shows $?=0
  2. grep is faster and works on rows level
  3. awk can only work on field level
  4. grep has -i option which can be used for ignoring case.
Question 12 Multiple Choice (Single Answer)

What is the command to check all active volume groups on AIX?

  1. lsvg
  2. lsvg -o
  3. lsvg -a
  4. activevg
Question 13 Multiple Choice (Single Answer)

What is the output of the following command?

echo "3*2"
  1. 3*2
  2. 6
  3. syntax error
  4. Blank line
Question 14 Multiple Choice (Single Answer)

What is the command to execute the executable script test.sh in the current shell?

  1. ./test.sh
  2. . test.sh
  3. sh test.sh
  4. exec test.sh