Linux Essentials
These are shell commands on the server, not PuTTY features. They work over any SSH client, including PuTTY.
| Command | What it does |
|---|---|
| Show the directory you are in | |
| List files, including hidden ones, with sizes and permissions | |
| Change directory ( goes up, goes back, alone goes home) | |
| Print a file to the screen | |
| Copy a file ( for a directory) | |
| Move or rename a file | |
| Delete a file ( deletes a directory and everything in it) | |
| Create a directory | |
| Edit a file (Ctrl+O saves, Ctrl+X exits) | |
| Change permissions (see the chmod calculator) | |
| Run a command as root | |
| Change your password | |
| Extract a .tar.gz ( creates one) | |
| Extract a .zip ( creates one) | |
| Download a file onto the server | |
| Log out and close the PuTTY window |
Viewing Files and Logs
| Command | What it does |
|---|---|
| Page through a file ( quits, searches, jumps to the end) | |
| Follow a log as it grows (Ctrl+C stops) | |
| Show the last 100 lines | |
| Show the first 20 lines | |
| Print lines containing error ( ignores case) | |
| Search every file under a directory | |
| Last 50 log lines from a systemd service ( follows) | |
| Recent kernel messages, useful for hardware and USB problems | |
| Find files by name | |
| Size of a directory | |
| Count lines in a file |
System and Processes
| Command | What it does |
|---|---|
| Disk space per filesystem | |
| Memory in use and free | |
| Live process list ( quits); if installed | |
| Find a running process | |
| Stop a process by PID ( forces it) | |
| Is a service running (, , , also work) | |
| Load and time since boot | |
| The server's IP addresses ( for the full list) | |
| Kernel and architecture; for the distro | |
| Which ports are listening and which process owns them | |
| Keep a job running after you close PuTTY | |
| Restart the server ( powers it off) |
Keyboard Shortcuts
Copy and paste are where PuTTY differs most from a Windows program.
| Key | Action |
|---|---|
| Left-click and drag | Select text, which copies it to the clipboard on its own |
| Right-click | Paste |
| Shift+Insert | Paste |
| Ctrl+Insert | Copy the current selection again |
| Double-click, triple-click | Select a word, select a line |
| Shift+drag | Select text when a program (vim, htop) has taken over the mouse |
| Alt+drag | Rectangular selection |
| Shift+PgUp, Shift+PgDn | Scroll the window a page at a time |
| Ctrl+PgUp, Ctrl+PgDn | Scroll one line |
| Ctrl+C | Interrupt the running command (not copy) |
| Ctrl+D | Send end of file; on an empty prompt this logs out |
| Ctrl+Z | Suspend the foreground job ( resumes it) |
| Ctrl+L | Clear the screen |
| Ctrl+R | Search command history as you type |
| Up, Down | Step through previous commands |
| Tab | Complete a file name or command |
| Ctrl+A, Ctrl+E | Jump to start or end of the line |
| Ctrl+U, Ctrl+W | Delete to start of line, delete the previous word |
| Ctrl+right-click | Open PuTTY's own menu (Restart Session, Change Settings, Special Command) |
Ctrl+Shift+C and Ctrl+Shift+V are off by default. Turn them on under Window > Selection > "Ctrl+Shift+C/V" if you want them.
Session Actions
| Action | How |
|---|---|
| Clear the screen | or Ctrl+L |
| Clear the scrollback too | then Ctrl+right-click > Clear Scrollback |
| Log out | , , or Ctrl+D on an empty prompt |
| Close a hung session | Close the window (Alt+F4); OpenSSH's escape does not exist in PuTTY |
| Reconnect after a drop | Ctrl+right-click > Restart Session |
| Open a second window to the same host | Ctrl+right-click > Duplicate Session |
| Change settings mid-session | Ctrl+right-click > Change Settings (window and colour options apply live) |
| Send a break (Cisco console, hung serial device) | Ctrl+right-click > Special Command > Break |
| Fix a garbled screen after on a binary | , or Ctrl+right-click > Reset Terminal |
| Save everything from this window | Ctrl+right-click > Copy All to Clipboard |
| Show your command history | ; to search it |
| Rerun a previous command | for the last one, for entry 42 |
| Check the PuTTY version | Help > About, or from a command prompt |
Session Settings
Set these in the PuTTY configuration window, then go back to Session and click Save so they stick.
| Setting | Where | Notes |
|---|---|---|
| Keepalive | Connection > Seconds between keepalives | Set to (0 is off). Stops idle drops; see Software caused connection abort |
| Auto-login username | Connection > Data > Auto-login username | Skips the prompt |
| Run a command after login | Connection > SSH > Remote command | Replaces the login shell; also set Session > Close window on exit to Never for one-off commands |
| Keep a shell after the command | Same field | |
| Private key | Connection > SSH > Auth > Credentials | Needs a ; convert with the PEM to PPK converter or make one with the PuTTY key generator |
| Session logging | Session > Logging > All session output | Use in the file name for one log per day |
| X11 forwarding | Connection > SSH > X11 > Enable X11 forwarding | Needs VcXsrv or Xming running first; see Cannot open display |
| Port forwarding | Connection > SSH > Tunnels | Source port , destination , click Add |
| Bigger scrollback | Window > Lines of scrollback | Default is 2000; costs nothing noticeable |
| Local echo (serial, modems) | Terminal > Local echo: Force on | For when you cannot see what you type |
Command Line Options
accepts these from a Windows command prompt, PowerShell, or a shortcut's Target field. Most map to a field in the configuration window.
| Option | What it does |
|---|---|
| Open an SSH session (, , for the others) | |
| Port (uppercase P) | |
| Username, as an alternative to | |
| Private key in PuTTY's format | |
| Password. Avoid it: it shows in Task Manager and shell history | |
| Password from a file (PuTTY 0.77 and newer) | |
| Open a saved session; other options on the line override it | |
| Run the commands in the file instead of a shell | |
| Local port forward (repeat for more) | |
| Remote port forward | |
| Dynamic SOCKS proxy on local port 1080 | |
| Forward ports only, no shell | |
| / | Enable or disable X11 forwarding |
| / | Enable or disable agent forwarding |
| / | Use or ignore Pageant for authentication |
| Compression | |
| Accept only this host key (scripting) | |
| Log the session to a file | |
| Serial session: port, then speed, data bits, parity, stop bits, flow control | |
| Verbose connection details in the event log | |
| Remove PuTTY's registry entries and random seed file | |
| Print the version and exit |
Examples:
putty.exe -ssh [email protected] -P 2222 -i C:\keys\admin.ppk
putty.exe -load "prod-web" -L 8080:localhost:80
putty.exe -serial COM3 -sercfg 9600,8,n,1,NThere is no command line flag for keepalives. Set them in a saved session and open it with .
plink
plink is PuTTY without the window: it runs one command on a remote host and prints the output, so it is the piece you use in batch files and scheduled tasks. It shares the options above.
| Command | What it does |
|---|---|
| Run a command and print the output | |
| Save the output to a local file | |
| Never prompt; fail instead (for scripts) | |
| Authenticate with a key | |
| Accept only the expected host key, so a first run never hangs on the prompt | |
| Run every line of a file | |
| Same, reading from standard input | |
| Use a saved session's host, port, and key | |
| Open a tunnel and keep it up, no shell | |
| No pseudo-terminal, cleaner output for parsing | |
| Interactive session in the current console window |
A batch file that checks a server every morning:
@echo off
plink -batch -i C:\keys\admin.ppk -hostkey SHA256:REPLACE [email protected] "df -h; uptime" > C:\logs\morning.txtpscp
pscp copies files between Windows and a server over SSH. Remote paths are .
| Command | What it does |
|---|---|
| Upload a file | |
| Download a file to the current directory | |
| Download a directory (recursive) | |
| Upload a directory | |
| Non-standard port (uppercase P) | |
| Authenticate with a key | |
| Preserve timestamps and permissions | |
| List a remote directory | |
| Never prompt (scripts) | |
| / | Force the SFTP or SCP protocol; SFTP is the default when the server offers it |
| Quote remote paths that contain spaces |
psftp
psftp is an interactive FTP-style session over SSH. Start it with (add , as for pscp), then use these at the prompt.
| Command | What it does |
|---|---|
| Connect, if you started psftp with no host | |
| or | List the remote directory |
| Change remote directory ( shows it) | |
| Change the local directory ( shows it) | |
| Download a file to the local directory | |
| Upload a file | |
| Download several files by wildcard | |
| Upload several files | |
| / | Download or upload a directory |
| Resume an interrupted download ( for uploads) | |
| , | Create or remove a remote directory |
| , | Delete or rename a remote file |
| Change remote permissions | |
| Run a local Windows command | |
| Disconnect and quit ( and also work) |
Scripted transfers go in a file, one command per line, and run with . Add to continue past errors and to echo each command.
Serial Connections
For console cables, Raspberry Pi and Arduino boards, and modems. Set Connection type to Serial in the Session panel, or use on the command line.
| Setting | Value |
|---|---|
| Serial line | The COM port from Device Manager > Ports (COM & LPT), e.g. |
| Speed | for most network gear consoles; for Raspberry Pi, ESP32, and most dev boards |
| Data bits, stop bits, parity | , , (written 8N1) |
| Flow control | (XON/XOFF is PuTTY's default and can hang a session) |
| Command line |
If nothing appears after connecting, press Enter once; a console does not print until you do. If PuTTY refuses the port, see Unable to open serial port. If you cannot see what you type, set Terminal > Local echo to Force on.
Modem and cellular module AT commands, typed into the serial session:
| Command | What it does |
|---|---|
| Should answer ; confirms the link and speed are right | |
| Manufacturer and model | |
| Turn on echo so you can see what you type ( off) | |
| Signal quality (0 to 31; 99 means no signal) | |
| SIM status | |
| Current network operator | |
| Reset to the saved profile | |
| Reset to factory defaults |
Cisco and Network Devices
Over the console cable or SSH to a switch or router, PuTTY is just the window; these are IOS commands. The prompt tells you the mode: is user mode, is privileged, is global configuration.
| Command | What it does |
|---|---|
| Enter privileged mode | |
| Enter configuration mode | |
| The active configuration ( for short) | |
| The saved configuration | |
| Every interface with IP and up/down state | |
| Port speed, duplex, VLAN, and link state (switches) | |
| VLANs and their ports | |
| Which MAC is on which port | |
| Model, IOS version, uptime, serial number | |
| Device log | |
| Stop the pauses for the session | |
| Select a port (from config mode) | |
| Put the selected port in VLAN 10 | |
| / | Disable or enable the selected port |
| Back to privileged mode from anywhere in config | |
| Save the running config (same as ) | |
| Reboot the device | |
| Leave the current mode, or log out from user mode | |
| List the commands valid here; lists completions, Tab completes |
Aruba and HP ProCurve switches use the same shape: , , , , and . Juniper uses , , and instead.
Connection refused when you SSH to a switch usually means SSH is not turned on yet; see Network error: Connection refused.
Gotchas
- Ctrl+C is interrupt, not copy. Selecting text already copied it; right-click pastes. Pasting a multi-line snippet runs every line the moment it lands, so check it first.
- A session that drops after a few idle minutes wants a keepalive, not a bigger scrollback. Connection > Seconds between keepalives: 30, then Save.
- on the command line is visible to every user on the machine in Task Manager. Use a key with , or Pageant.
- PuTTY cannot use an OpenSSH or key directly. Convert it to with the PEM to PPK converter or PuTTYgen.
- Closing the PuTTY window kills whatever was running in it. For a long job, start it under , , or .
- There is no file transfer inside the PuTTY window. Downloads and uploads go through pscp, psftp, or WinSCP from a separate command prompt.
- Windows 10 and 11 ship OpenSSH, so in PowerShell works without PuTTY at all. PuTTY still wins for serial ports and saved sessions. The PuTTY download page covers which build to install.