Unix Scripting Questions
Unix Scripting Questions
1. What is a shell?
2. What is Bash?
3. What is a shell script?
4. How do you write a shell script?
5. What is the file extension for a shell script?
6. How do you run a shell script?
7. What is the shebang line?
8. What is the purpose of the shebang line?
9. What is a comment in a shell script?
10. How do you write a comment in a shell script?
11. What is a variable in a shell script?
12. How do you create a variable in a shell script?
13. What is the syntax for a variable in a shell script?
14. What is the scope of a variable in a shell script?
15. What is command substitution?
16. How do you use command substitution in a shell script?
17. What is command chaining?
18. How do you use command chaining in a shell script?
19. What is a function in a shell script?
20. How do you create a function in a shell script?
21. What is the syntax for a function in a shell script?
22. What is the return value of a function in a shell script?
23. How do you call a function in a shell script?
24. What is a conditional statement in a shell script?
25. How do you use a conditional statement in a shell script?
26. What is a loop in a shell script?
27. How do you use a loop in a shell script?
28. What is an array in a shell script?
29. How do you create an array in a shell script?
30. What is the syntax for an array in a shell script?
31. How do you access elements in an array in a shell script?
32. What is input/output redirection?
33. How do you use input/output redirection in a shell script?
34. What is a pipeline in a shell script?
35. How do you use a pipeline in a shell script?
36. What is a command-line argument?
37. How do you pass command-line arguments to a shell script?
38. What is the $0 variable in a shell script?
39. What is the $1 variable in a shell script?
40. What is the $2 variable in a shell script?
41. What is the $# variable in a shell script?
42. What is the $@ variable in a shell script?
43. What is the $? variable in a shell script?
44. What is the $$ variable in a shell script?
45. What is the $! variable in a shell script?
46. What is a signal in a shell script?
47. How do you handle signals in a shell script?
48. What is process substitution?
49. How do you use process substitution in a shell script?
50. What is a here document?
51. How do you use a here document in a shell script?
52. What is a here string?
53. How do you use a here string in a shell script?
54. What is a glob?
55. How do you use a glob in a shell script?
56. What is brace expansion?
57. How do you use brace expansion in a shell script?
58. What is a subshell?
59. How do you create a subshell in a shell script?
60. What is a background process?
61. How do you run a process in the background in a shell script?
62. What is a foreground process?
63. How do you run a process in the foreground in a shell script?
64. What is the difference between a foreground process and a background process?
65. What is a job in a shell script?
66. How do you manage jobs in a shell script?
67. What is a signal trap?
68. How do you use a signal trap in a shell script?
69. What is a sourced file?
70. How do you source a file in a shell script?
71. What is a script library?
72. How do you create a script library in a shell script?
73. What is a script module?
74. How do you create a script module in a shell script?
75. What is a script package?
76. How do you create a script package in a shell script?
77. What is a script template?
78. How do you create a script template in a shell script?
79. What is a script generator?
80. How do you create a script generator in a shell script?
81. What is a script runner?
82. How do you create a script runner in a shell script?
83. What is a script debugger?
84. How do you create a script debugger in a shell script?
85. What is a script profiler?
86. How do you create a script profiler in a shell script?
87. What is a script unit tester?
88. How do you create a script unit tester in a shell script?
89. What is a script integration tester?
90. How do you create a script integration tester in a shell script?
91. What is a script acceptance tester?
92. How do you create a script acceptance tester in a shell script?
93. What is a script deployment tool?
94. How do you create a script deployment tool in a shell script?
95. What is a script version control system?
96. How do you use a script version control system in a shell script?
97. What is a script documentation tool?
98. How do you create a script documentation tool in a shell script?
99. What is a script build system?
100. How do you create a script build system in a shell script?
Questions for Unix Practice
File and Directory Operations:
Process Management: 6. List all running processes. 7. Find the process ID of a process
named "nginx." 8. Kill a process with a specific process ID. 9. Start a command in the
background and then bring it to the foreground. 10. Run a command and make it immune
to hangups using nohup .
Text Processing: 11. Search for the word "error" in a file named "log.txt." 12.
Extract the first column from a CSV file. 13. Count the number of lines in a file. 14.
Replace all occurrences of "old_text" with "new_text" in a file. 15. Display the last
10 lines of a file named "output.log."
Networking: 16. Ping a specific IP address to check its connectivity. 17. Display
network information for all network interfaces. 18. Download a file from a specific
URL using wget . 19. Transfer a file named "data.txt" to a remote server using scp .
20. Establish an SSH connection to a remote server.
System Information: 21. Display the amount of free and used disk space. 22. Check the
available memory on the system. 23. Display the system's uptime. 24. List all
currently logged-in users. 25. Find out the operating system type using uname .
Package Management: 26. Install a package named "nginx" using the appropriate package
manager. 27. Update all installed packages on the system. 28. Search for a package
named "python" using the package manager. 29. Remove a package named "apache" using
the package manager.
File Search: 30. Locate all files with the extension ".txt" on the system. 31. Find
the location of the executable file for the command "ls." 32. Search for files related
to a specific program using whereis .
File Editors: 33. Open a file named "notes.txt" for editing using nano . 34. Edit a
file named "config.conf" using the vi or vim editor. 35. Save and exit the editor
after making changes to a file.
System Control: 36. Reboot the system using the appropriate command. 37. Shut down the
system gracefully. 38. Halt the system immediately.
User Management: 39. Create a new user account named "john." 40. Modify the password
of the user account "mary." 41. Delete a user account named "jane."
Feel free to use these questions to practice and deepen your understanding of Unix
commands. If you're stuck on any particular question, you can refer to the command
descriptions and examples provided earlier or use the man command to access the
manual pages for more information.