Blog 5: Learn VIM Editor & Linux User Commands (Simple & Powerful)

Blog 5: VIM Editor & User Management in DevSecOps

🔧 Blog 5: VIM Editor & User Management – Power Tools for DevSecOps

📅 By Kalyan Kalavena | 🔐 All Rights Reserved

✍️ What Is VIM Editor in Linux?

VIM is a powerful text editor used directly in Linux terminals. It’s super fast, keyboard-driven, and used for editing configuration files, scripts, and code.

🔑 Modes in VIM:

  • ESC Mode (Default) – Navigate and control the file.
  • Insert Mode – Start writing/editing content (press i to enter).
  • Command Mode – Start commands by pressing :.

📄 Command Mode (press :)

:q              --> Quit
:wq             --> Save and Quit
:q!             --> Force Quit (discard changes)
:/word          --> Search from top
:?word          --> Search from bottom
:noh            --> Remove highlight
:set nu         --> Show line numbers
:set nonu       --> Hide line numbers
:28d            --> Delete 28th line
:3s/old/new     --> Replace first match in line 3
:3s/old/new/g   --> Replace all in line 3
:%s/old/new/g   --> Replace all in file
:%d             --> Delete entire file content
  

🧠 ESC Mode Shortcuts

u       --> Undo
yy      --> Copy line
p       --> Paste
10p     --> Paste 10 times
dd      --> Cut line
gg      --> Go to top
Shift+G --> Go to bottom
  

👤 Linux User Management – Real World Admin Tasks

In DevSecOps, you’ll often need to manage users and their access rights.

✅ Basic User Commands

useradd kalyan            --> Create a user
id kalyan                 --> View user details
passwd kalyan             --> Set password
groupadd devops           --> Create a group
usermod -g devops kalyan  --> Set devops as primary group
usermod -aG testing kalyan --> Add testing as secondary group
  

Note: Each user must have one primary group and may have multiple secondary groups.

❌ Deleting Users

userdel kalyan

Step-by-step: Remove from group → remove from project → delete user.

🔐 SSH Configuration & Key-Based Authentication

Linux uses secure key-based logins over passwords for safety and automation.

File: /etc/ssh/sshd_config
Commands:
systemctl restart sshd    --> Restart SSH
sshd -t                   --> Test SSH config
  

🗝️ Key-Based Authentication (Secure Login)

  1. Generate key pair:
    ssh-keygen -f kalyan-key
  2. Upload .pub (public key) to server
  3. Keep .pem (private key) secure

🧠 Summary: What Kalyan Learned Today

  • VIM is your Linux text editor — fast, no mouse needed.
  • Managing users is like managing a team.
  • SSH keys = Security + Automation

Comments

Popular Posts