Understanding Bash, SSH, and PuTTY: A Practical Guide with Expanded Command Cheat Sheet


Bash and SSH are essential tools for anyone working with servers, development environments, or web hosting. To make remote access even more accessible—especially on Windows—tools like PuTTY play a major role. This expanded guide not only explains Bash and SSH in depth, but also introduces PuTTY and provides a more comprehensive cheat sheet of commands you can use right away.


What Is Bash?

Bash (Bourne Again Shell) is a command-line interface that allows you to interact directly with your operating system. It’s the default shell for most Linux systems and is also available on macOS and Windows (via tools like WSL or Git Bash).

Instead of clicking through menus, Bash allows you to execute commands directly, automate tasks, and control nearly every aspect of your system.


Why Bash Matters

Bash is not just a tool—it’s a productivity multiplier.

It allows you to:

  • Execute complex operations with a single command
  • Automate repetitive workflows using scripts
  • Manage files, processes, and services efficiently
  • Work seamlessly across different systems

For developers and system administrators, Bash is often the fastest and most reliable way to get things done.


What Is SSH?

SSH (Secure Shell) is a protocol that allows you to securely connect to remote computers over a network. It encrypts all communication, ensuring that your data remains private and secure.

When you connect to a remote server using SSH, you’re typically dropped into a Bash shell where you can begin executing commands.


Where PuTTY Fits In

If you’re using Windows, you may not have a built-in SSH client (older systems especially). That’s where PuTTY comes in.

PuTTY is a lightweight, free SSH client that allows you to connect to remote servers using a graphical interface.

Why PuTTY Is Useful

  • Simple interface for beginners
  • Stores saved sessions for quick access
  • Supports SSH keys for secure login
  • Includes tools like PuTTYgen (for key generation) and PSCP (for file transfer)

How It Works

Instead of typing ssh user@host in a terminal, PuTTY lets you:

  1. Enter the hostname or IP
  2. Choose the port (default 22)
  3. Click “Open” to connect

Once connected, you still interact with the server using Bash commands—PuTTY is just the bridge that gets you there.


Advantages of Using SSH (with or without PuTTY)

SSH provides:

  • Secure encrypted communication
  • Remote server access from anywhere
  • Automation capabilities via scripts
  • Secure file transfers
  • Key-based authentication (more secure than passwords)

When paired with Bash, SSH becomes an incredibly powerful remote management tool.


Expanded Bash & SSH Cheat Sheet

Below is a more comprehensive list of commands, organized by category.


System Information

uname -a          # Show system information
hostname          # Show system hostname
whoami            # Show current user
date              # Show current date/time
uptime            # Show how long system has been running
df -h             # Disk space usage
free -h           # Memory usage

Navigation

pwd               # Print working directory
ls                # List files
ls -lh            # Human-readable file sizes
ls -lt            # Sort by modification time
tree              # Show directory structure
cd folder         # Enter folder
cd ..             # Go up one level

File Operations

touch file.txt          # Create file
mkdir dir               # Create directory
mkdir -p a/b/c          # Create nested directories
rm file.txt             # Remove file
rm -rf dir              # Force remove directory
cp file1 file2          # Copy file
cp -r dir1 dir2         # Copy directory
mv file1 file2          # Move/rename file

File Viewing & Searching

cat file.txt            # Show contents
less file.txt           # Scroll through file
head file.txt           # First 10 lines
tail file.txt           # Last 10 lines
tail -f log.txt         # Live log monitoring
grep "text" file.txt    # Search for text
find / -name file.txt   # Find file

Permissions & Ownership

chmod 644 file          # Set permissions
chmod +x script.sh      # Make executable
chown user file         # Change owner
chgrp group file        # Change group

Process Management

ps aux                  # List processes
top                     # Real-time monitoring
htop                    # Improved top (if installed)
kill PID                # Kill process
killall process_name    # Kill by name

Networking

ping host               # Check connectivity
curl -I example.com     # Get headers
wget url                # Download file
netstat -tulnp          # Show open ports
ss -tuln                # Modern netstat alternative

SSH Commands

ssh user@host                # Connect to server
ssh -p 2222 user@host        # Custom port
ssh -i key.pem user@host     # Use key file
exit                         # Disconnect

SSH Key Management

ssh-keygen -t rsa -b 4096        # Generate key
ssh-copy-id user@host            # Install key on server
cat ~/.ssh/id_rsa.pub            # View public key

File Transfer (SSH-Based)

scp file.txt user@host:/path          # Upload
scp user@host:/file.txt .             # Download
scp -r dir user@host:/path            # Upload directory
rsync -avz file user@host:/path       # Efficient sync

Package Management (Debian/Ubuntu)

sudo apt update            # Update package list
sudo apt upgrade           # Upgrade system
sudo apt install nginx     # Install package
sudo apt remove nginx      # Remove package

Disk & Storage

mount /dev/sda1 /mnt       # Mount disk
umount /mnt                # Unmount disk
du -sh folder              # Folder size
lsblk                      # List block devices

Compression & Archives

tar -cvf file.tar dir      # Create tar
tar -xvf file.tar          # Extract tar
tar -czvf file.tar.gz dir  # Create gzip archive
tar -xzvf file.tar.gz      # Extract gzip
zip file.zip file          # Create zip
unzip file.zip             # Extract zip

Bash Scripting Basics

#!/bin/bash
echo "Hello World"

Run with:

chmod +x script.sh
./script.sh

Environment Variables

echo $PATH            # Show PATH
export VAR=value      # Set variable
env                   # List variables

History & Shortcuts

history               # Show command history
!!                    # Run last command
!123                  # Run command #123
Ctrl + C              # Cancel command
Ctrl + R              # Search history
Tab                   # Auto-complete

Final Thoughts

Bash and SSH are essential tools that unlock powerful capabilities in computing. Bash gives you control, speed, and automation, while SSH provides secure remote access to systems anywhere in the world.

For Windows users, PuTTY makes it easy to get started with SSH without needing a native terminal. Once connected, everything you do relies on Bash, making it the core skill to develop.

The expanded cheat sheet above is more than just a reference—it’s a toolkit. The more you practice these commands, the more confident and efficient you’ll become.

Mastering Bash and SSH doesn’t happen overnight, but with consistent use, they quickly become second nature—and one of the most valuable skills in tech.


Leave a Reply

Your email address will not be published. Required fields are marked *