Terminal Mastery: Essential Commands Every Dev Should Know

Why Terminal?

The terminal is the most powerful tool in a developer's arsenal. While GUIs are convenient, the command line offers:

  • Speed - Execute tasks in seconds
  • Automation - Script repetitive tasks
  • Power - Access to low-level system functions
  • Control - Fine-grained control over your system

Essential Commands

File Navigation

# List files
ls -la

# Change directory
cd /path/to/directory

# Print working directory
pwd

# Create directory
mkdir new-folder

# Remove files
rm -rf unwanted-folder

File Manipulation

# Copy files
cp source.txt destination.txt

# Move/rename files
mv old-name.txt new-name.txt

# View file contents
cat file.txt
less file.txt

# Search in files
grep "pattern" file.txt

Process Management

# List running processes
ps aux

# Kill process
kill -9 <PID>

# Monitor system resources
top
htop

Pro Tips

Aliases

Create shortcuts for common commands:

# Add to ~/.bashrc or ~/.zshrc
alias ll='ls -la'
alias gs='git status'
alias gp='git push'

Pipes and Redirection

Combine commands for powerful workflows:

# Pipe output to another command
ls -la | grep "txt"

# Redirect output to file
echo "Hello" > output.txt

# Append to file
echo "World" >> output.txt

History Navigation

# Search command history
Ctrl + R

# Run last command
!!

# Run last command with sudo
sudo !!

Advanced Tricks

Find and Execute

# Find all .js files and run eslint
find . -name "*.js" -exec eslint {} \;

# Delete all .log files older than 30 days
find . -name "*.log" -mtime +30 -delete

Text Processing

# Count lines in file
wc -l file.txt

# Sort and unique
sort file.txt | uniq

# Replace text
sed 's/old/new/g' file.txt

Conclusion

The terminal is your gateway to true system mastery. Practice these commands daily, and soon they'll become second nature.

> System knowledge: UPGRADED
> Skill level: ENHANCED
> Matrix access: GRANTED

Happy hacking! 🚀

[ Related Posts ]

[ Comments ]