DEV Community

Cover image for 10 Daily Linux Questions and Answers Series (part 6)
Alex Enson
Alex Enson

Posted on

10 Daily Linux Questions and Answers Series (part 6)

In this brief article, I present 10 essential Linux questions along with their answers.
This foundational knowledge is crucial for anyone seeking to master Linux.

VIM (Visual Display Editor Improved) (continued)
Q1: How do you split the Vim window and work with multiple files?
:split filename
Use :vsplit for vertical split.

Q2: How do you save and exit Vim?
• To save and exit:
:wq
• To exit without saving:
:q!

Q3: How do you search for a word in Vim?
/text_to_search

Q4: How do you comment multiple lines in Vim?
Use :normal mode and add # or comment characters. For example:
:normal I#

Q5: How do you execute shell commands from Vim?
:!command

Q6: How do you auto-indent a file in Vim?
gg=G

Q7: How do you convert tabs to spaces in Vim?
:set expandtab

Q8: How do you highlight all occurrences of a word in Vim?
:vimgrep /word/ *

Q9: How do you remove highlighting in Vim?
vim
:noh

Q10: How do you record and replay a macro in Vim?
• To start recording:
q(register)
• To stop recording:
q
• To replay the macro:
@(register)


Stay tuned for part 7 coming tomorrow!

Connect with me on LinkedIn


#30DaysLinuxChallenge #RedHatEnterpriseLinux
#CloudWhistler #CloudEngineer #Linux
#DevOps #RedHat #OpenSource
#CloudComputing #Automation
#CloudEngineer

Top comments (0)