Unix/Linux Shell Programming and Commands
Test your knowledge of Unix/Linux shell scripting variables, functions, and basic operating system commands
Questions
What is VI?
- A text editor
- The UNIX telnet service
- An E-mail client
- An FTP client
How do you create a new directory called "flower"?
- newdir flower
- mkdir flower
- crdir flower
- makedir flower
What command do you have to use to go to the parent directory?
- cd ..
- cd /up
- cd -
- cd ~
With what command you can see what folder you are in?
- whereami
- map
- place
- pwd
With what can you stop a process?
- Shutdown
- stop
- kill
- delete
With what command you can see your user name?
- I
- me
- whoami
- pwd
The Command :>filename is used to
- Empty the existing file or create an empty file
- Print the string : to filename
- Delete the file
- Append the file at the last line
The Default variable $TZ is used to[wrong]
- display the number of Zombie process in the system
- set the time zone
- set the time for zip process
- display the last test condition result
filename=sample.txtfile=${filename%.*}echo $file$file now contains
- txt
- sample
- .txt
- sample.
How to call the function function1 in shell
- function1()
- call function1
- function1
- ask function1
The Command :>filename is used to
- Empty the existing file or create an empty file
- Print the string : to filename
- Delete the file
- Append the file at the last line
The Default variable $TZ is used to
- display the number of Zombie process in the system
- set the time zone
- set the time for zip process
- display the last test condition result
filename=sample.txt file=${filename%.*} echo $file $file now contains
- txt
- sample
- .txt
- sample.
How to call the function function1 in shell
- function1()
- call function1
- function1
- ask function1
What are the ways to get the filename from the absolute path in a variable Mypath=/my/path/file
- filename=
basename Mypath - filename =
file Mypath - filename = ${Mypath#/*/*/}
- echo \$Mypath | awk ‘ FS=”/” { print \$4 } ‘
Which variable contains the return value of last executed command
- $!
- $?
- $#
- $@
which operator is used for testing condition
- check
- test
- expr
- find
Which variable holds the values of command line parameters
- $#
- $*
- $@
- $?
which variable holds the number of values of comman line parameters
- $#
- $*
- $@
- $?
ksh shell was developed by
- Korn Matt
- Karthick Subramanian
- David Korn
- Kandasamy