Essential Linux Commands Every Developer Should Know

Linux command line skills are essential for developers. This guide covers the most useful commands for daily work.

## File Operations

```bash
# Navigate
cd /path/to/dir
ls -la  # List all files
pwd     # Print working directory

# Create
mkdir -p folder/subfolder
touch file.txt

# Copy/Move
cp source.txt dest.txt
mv old.txt new.txt
rm -rf folder/

# Search
find . -name "*.js"
grep -r "function" ./src
```

## Process Management

```bash
# List processes
ps aux | grep node
top
htop

# Kill process
kill -9 <pid>

# Background jobs
jobs
bg 1
fg 1
```

## Network Commands

```bash
# Check connectivity
ping google.com
curl -I https://example.com
wget file.url

# Ports
netstat -tlnp
lsof -i :3000
```

## Text Processing

```bash
# View files
cat file.txt
head -n 10 file.txt
tail -f log.txt

# Edit
sed -i 's/old/new/g' file.txt
awk '{print $1}' file.txt
```

## System Info

```bash
df -h           # Disk usage
free -h         # Memory
uname -a        # System info
whoami
```

## SSH & SCP

```bash
# Connect
ssh user@host

# Copy over SSH
scp file.txt user@host:/path/
rsync -avz ./src/ user@host:/path/
```

## Archives

```bash
# Compress
gzip file.txt
tar -czvf archive.tar.gz folder/

# Extract
tar -xzvf archive.tar.gz
```

## Conclusion

Master these commands to work efficiently on Linux servers and improve your development workflow.

评论
暂无评论