Unix/Linux Operating System Commands
Test your knowledge of Unix/Linux operating system commands, shell scripting, process management, and system administration tasks.
Questions
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
- the first 'hi' will be displayed but it will say "Could not delete file: in use" and will exit the script
- the first 'hi' will be displayed but it will say "Could not delete file: in use" and will then echo the second 'hi'
- The script will display 2 'hi' and the file will also be deleted
- The first 'hi' will be displayed, the script will be deleted , but the 2nd 'hi' will not be displayed.
I have a file named "-p" in my home directory. Which of the following commands will be used to delete this file?
- rm -p
- rm -f -p
- rm -f -- -p
- rm -f "-p"
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)
- a) date 1123180809
- b) date 2311180809
- c) date -s "Mon Nov 23 18:08:07 IST 2009"
- d) Both a and c
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?
- Press Ctrl-Z and type "bg"
- Press Ctrl-D and type "bg"
- Open a new termial and type "bg <pid>" where <pid> is the pid of that script
- None of these
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?
- uuencode coomand
- attach command
- compress command
- Its not possilble to send attachment from unix
What is the output of the following command in bash shell on Linux? $ i=2 $ [ $i -lt 2 ] || echo great
- great
- no output
- test: syntax error
- we will have to export the value of i
Find the output of the last echo command: $ pwd /home/guest $ cat test.sh export i=100 $ sh test.sh $ echo $i
- 100
- blanck line
- No such variable $i
- None of these
What is the output of the following command? $ cd -
- change to home directory
- change directory to last directory as saved in the environment variable OLDPWD
- move to the last directory of that structure
- None of these
The password of an unix user can be changed by the following command:
- passwd
- passwd and pwdadm
- pwdadm
- password
What does this command show? $ echo $TZ
- The DayLight Saving Time
- The Time zone
- blanck line
- You will have to set the value of TZ variable first
What is the advantage of grep over awk with reference to decision-making scripts?
- grep shows different values for $? while awk always shows $?=0
- grep is faster and works on rows level
- awk can only work on field level
- grep has -i option which can be used for ignoring case.
What is the command to check all active volume groups on AIX?
- lsvg
- lsvg -o
- lsvg -a
- activevg
What is the output of the following command?
echo "3*2"
- 3*2
- 6
- syntax error
- Blank line
What is the command to execute the executable script test.sh in the current shell?
- ./test.sh
- . test.sh
- sh test.sh
- exec test.sh