Frequently asked questions and answers of Z shell (Zsh) in Programming Technologies of Computer Science to enhance your skills, knowledge on the selected topic. We have compiled the best Z shell (Zsh) Interview question and answer, trivia quiz, mcq questions, viva question, quizzes to prepare. Download Z shell (Zsh) FAQs in PDF form online for academic course, jobs preparations and for certification exams .
Intervew Quizz is an online portal with frequently asked interview, viva and trivia questions and answers on various subjects, topics of kids, school, engineering students, medical aspirants, business management academics and software professionals.
Question-1. How do you display the current Zsh options?
Answer-1: Use setopt.
Question-2. How do you turn off a Zsh option?
Answer-2: Use unsetopt option_name.
Question-3. What is the glob feature in Zsh?
Answer-3: It allows advanced pattern matching, such as ls **/*.txt for recursive file search.
Question-4. What is shopt in Zsh?
Answer-4: Zsh does not use shopt (a Bash feature); instead, it uses setopt and unsetopt.
Question-5. How do you enable recursive globbing in Zsh?
Answer-5: Use setopt GLOB_STAR.
Question-6. How do you prevent duplicate history entries in Zsh?
Answer-6: Add setopt HIST_IGNORE_ALL_DUPS to .zshrc.
Question-7. How do you search command history interactively in Zsh?
Answer-7: Use Ctrl + R.
Question-8. How do you change the Zsh prompt?
Answer-8: Modify the PROMPT variable in .zshrc.
Question-9. What does %~ represent in the Zsh prompt?
Answer-9: It shows the current directory, replacing $HOME with ~.
Question-10. How do you execute the last command in Zsh?
Answer-10: Use !!.
Question-11. How do you execute the last command starting with a specific word?
Answer-11: Use !word.
Question-12. What is fc in Zsh?
Answer-12: A built-in command to edit and re-execute previous commands.
Question-13. How do you run a command without saving it to history?
Answer-13: Use a space before the command (if HIST_IGNORE_SPACE is enabled).
Question-14. How do you append command history to the history file immediately?
Answer-14: Use setopt INC_APPEND_HISTORY.
Question-15. What is zmodload in Zsh?
Answer-15: It loads Zsh modules dynamically.
Question-16. How do you enable shared history across multiple Zsh sessions?
Answer-16: Use setopt SHARE_HISTORY.
Question-17. How do you disable globbing in Zsh?
Answer-17: Use set -o noglob.
Question-18. What does exec zsh do?
Answer-18: It restarts the Zsh shell.
Question-19. How do you enable debugging in Zsh?
Answer-19: Use set -x before running a command.
Question-20. How do you find the full path of a command in Zsh?
Answer-20: Use which command_name.
Question-21. How do you check the exit status of the last command in Zsh?
Answer-21: Use echo $?.
Question-22. How do you run a command in the background in Zsh?
Answer-22: Append & to the command, e.g., sleep 10 &.
Question-23. How do you kill a background job in Zsh?
Answer-23: Use kill %job_id or kill PID.
Question-24. What is the nohup command in Zsh?
Answer-24: It runs a command that ignores the SIGHUP signal.
Question-25. How do you display all background jobs in Zsh?
Answer-25: Use jobs.
Question-26. How do you suspend a running process in Zsh?
Answer-26: Press Ctrl + Z.
Question-27. How do you resume a suspended job in Zsh?
Answer-27: Use fg to bring it to the foreground.
Question-28. How do you exit Zsh?
Answer-28: Use exit or press Ctrl + D.
Question-29. What is Zsh?
Answer-29: Z shell (Zsh) is an extended Unix shell with advanced features, including better auto-completion, globbing, and scripting capabilities.
Question-30. How is Zsh different from Bash?
Answer-30: Zsh has better auto-completion, spelling correction, improved globbing, and more powerful scripting features compared to Bash.
Question-31. How do you check if Zsh is installed?
Answer-31: Run zsh --version in the terminal.
Question-32. How do you set Zsh as the default shell?
Answer-32: Use chsh -s $(which zsh).
Question-33. Where is the Zsh configuration file located?
Answer-33: It is located at ~/.zshrc.
Question-34. How do you reload the .zshrc file?
Answer-34: Run source ~/.zshrc.
Question-35. What is Oh My Zsh?
Answer-35: A popular framework for managing Zsh configuration, themes, and plugins.
Question-36. How do you install Oh My Zsh?
Answer-36: Use sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)".
Question-37. How do you change the Zsh theme?
Answer-37: Edit ~/.zshrc and change ZSH_THEME="theme_name", then reload the shell.
Question-38. How do you list all available Oh My Zsh themes?
Answer-38: Run ls ~/.oh-my-zsh/themes/.
Question-39. What is a Zsh plugin?
Answer-39: A script that extends Zsh?s functionality, such as syntax highlighting and auto-suggestions.
Question-40. How do you enable a plugin in Zsh?
Answer-40: Add the plugin name to the plugins=(plugin_name) line in .zshrc and reload Zsh.
Question-41. What is the Zsh auto-suggestions plugin?
Answer-41: It suggests commands as you type based on command history.
Question-42. How do you install the Zsh auto-suggestions plugin?
Answer-42: Use git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/zsh-autosuggestions and add it to .zshrc.
Question-43. What is the purpose of the Zsh syntax highlighting plugin?
Answer-43: It highlights commands based on their validity and syntax.
Question-44. How do you install Zsh syntax highlighting?
Answer-44: Clone the repository and source it in .zshrc: git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.zsh/zsh-syntax-highlighting.
Question-45. What is the bindkey command in Zsh?
Answer-45: It is used to modify keybindings in Zsh.
Question-46. How do you enable case-insensitive tab completion in Zsh?
Answer-46: Add setopt NO_CASE_GLOB to .zshrc.
Question-47. What does autoload -U compinit && compinit do?
Answer-47: It enables and initializes advanced command completion.
Question-48. How do you create an alias in Zsh?
Answer-48: Use alias name='command', e.g., alias ll='ls -la'.
Question-49. How do you remove an alias in Zsh?
Answer-49: Use unalias name.
Question-50. What is the preexec function in Zsh?
Answer-50: It runs before each command execution.
Frequently Asked Question and Answer on Z shell (Zsh)
Z shell (Zsh) Interview Questions and Answers in PDF form Online
Z shell (Zsh) Questions with Answers
Z shell (Zsh) Trivia MCQ Quiz