Unix/Linux Commands and Shell Scripting
Test your knowledge of essential Unix/Linux operating system commands, shell scripting operators, process management, and file operations.
Questions
How can you append the output of a command to a file?
- command << file
- command > file
- command <> file
- command >> file
Using which command you can see your user name?
- whoami
- pwd
- who
- uname
How can you display list of all files, including the hidden files?
- find -a
- ls -a
- find all
- ls -l
How to create a new file, without opening it?
- touch filename
- cat filename
- less filename
- create filename
Using which command you can stop a process?
- stop
- kill
- delete
- sleep
How do you get all files, which having 3rd place as r, g or i?
- ls [rgi]
- ls ?3[rgi]*
- ls ??[rgi]*
- ls **[rgi]?
Which command is used to modify the access time of a file?
- chmod
- touch
- chown
- mtime
vim editor uses which hidden file for configuration settings
- .bashrc
- .exrc
- .usrc
- .vimrc
How do we configure the vim editor to automatically add numbers to the file when it opens?
- se nu
- se nonu
- se n
- se history
What command used to Look at a file, one page at a time
- cat
- more
- less
- view
Which command is used to display all the files?
- ls
- cat
- ls -a
- type
- dir
Which command is used to modify the access time of a file?
- chmod
- chown
- touch
- cd
- grep
vim editor uses which hidden file for configuration settings?
- .bashrc
- .exrc
- .etcrc
- .vimrc
- .usrc
How do we configure vim editor to automatically add numbers to the file when it opens?
- se nu
- se bs
- se history
- se noai
- se nonu
Which command is used to view the file without modifying it?
- view
- cat
- more
- head
- tail
How do you find out what's your shell?
- echo $shell
- ls $shell
- view $shell
- cat $shell
- show $shell
How do you stop a process?
- kill pid
- stop pid
- abort pid
- exit pid
- None of the above
Which of these is a number comparison operator in shell scripts?
- -eq
- -ne
- -lt
- All of the above
- None of the above
Which of these is a Boolean logic operators in shell scritping?
- - !
- - a
- - o
- All of the above
- None of the above
You need to see the last fifteen lines of a file. What command should you use?
- tail -15 filename
- head -15 filename
- zcat -15 filename
- All of the above
- None of the above