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)
Q1: How do you open a file in Vim without modifying its timestamp?
vim -n filename
Q2: How can you recover an unsaved file after Vim crashes or the system reboots?
Search for swap files:
ls -a | grep .swp
Q3: How do you open a file at a specific line number in Vim?
vim +linenumber filename
Q4: How do you enable line numbers permanently in Vim?
Add to ~/.vimrc:
vim
set number
Q5: How do you delete all blank lines in a file using Vim?
vim
:g/^$/d
Q6: How do you remove trailing spaces from a file in Vim?
vim
:%s/\s+$//e
Q7: How do you replace a word globally in Vim?
vim
:%s/oldword/newword/g
Q8: How do you copy (yank) and paste in Vim?
• Yank: yy
• Paste: p
Q9: How do you enable syntax highlighting in Vim?
vim
syntax enable
Q10: How do you edit multiple files in Vim and switch between them?
Open with vim file1 file2 and switch with :n or :prev.
Stay tuned for part 6 coming tomorrow!
Connect with me on LinkedIn
#30DaysLinuxChallenge #RedHatEnterpriseLinux
#CloudWhistler #CloudEngineer #Linux
#DevOps #RedHat #OpenSource
#CloudComputing #Automation
#CloudEngineer