Cheat Sheet

PuTTY Commands

PuTTY is the free SSH and serial client most Windows users start with. This sheet covers the Linux commands you type inside a PuTTY session, the keyboard shortcuts, and the command line options for putty.exe, plink, pscp, and psftp.

Last updated August 29, 2026

Linux Essentials

These are shell commands on the server, not PuTTY features. They work over any SSH client, including PuTTY.

CommandWhat 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

CommandWhat 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

Text Editors

nano is the easy one and is on most servers. vi is on every server, including the stripped-down ones, so it is worth knowing enough to get out of.

CommandWhat it does
Open a file in nano ( for one you do not own)
, Save in nano
Exit nano; it offers to save first
, , Search, cut the current line, paste it back
Open a file in vi or vim
Start typing; Esc goes back to command mode
, , Save, save and quit, quit without saving
, , Delete a line, copy a line, paste it below
then Search, then jump to the next match
, Jump to the first or last line
Show line numbers
, Ctrl+RUndo, redo

Stuck in vi with nothing happening: press Esc, then type and Enter. Nano's Ctrl+O and Ctrl+X are its own, not PuTTY's, so they reach the editor normally.

System and Processes

CommandWhat 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)

Networking

CommandWhat it does
Every interface with its IP address ( for IPv4 only)
Just the IP addresses, space separated
Routing table, including the default gateway
Link state and the interface's MAC address
ARP table: which MAC answers for each neighbour ( on older systems)
Send four pings (without it runs until Ctrl+C)
Hops to a host; for a live view
DNS lookup ( and also work)
Fetch the response headers only
Test whether a port is reachable from this server
Current connections ( for listening ports)
Firewall rules on Ubuntu ( on RHEL)
Negotiated link speed and duplex

, , and are gone from most current distros; and replace them. Changing an interface address over SSH cuts your own session off the moment it applies, so make that change over the serial console instead.

Keyboard Shortcuts

Copy and paste are where PuTTY differs most from a Windows program.

KeyAction
Select text, which copies it to the clipboard on its own
Paste
Paste
Copy the current selection again
, Select a word, select a line
Select text when a program (vim, htop) has taken over the mouse
Rectangular selection
, Scroll the window a page at a time
, Scroll one line
Interrupt the running command (not copy)
Send end of file; on an empty prompt this logs out
Suspend the foreground job ( resumes it)
Clear the screen
Search command history as you type
Up, DownStep through previous commands
TabComplete a file name or command
, Jump to start or end of the line
, Delete to start of line, delete the previous word
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

ActionHow
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 sessionClose the window (Alt+F4); OpenSSH's escape does not exist in PuTTY
Reconnect after a dropCtrl+right-click > Restart Session
Open a second window to the same hostCtrl+right-click > Duplicate Session
Change settings mid-sessionCtrl+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 windowCtrl+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 versionHelp > 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.

SettingWhereNotes
KeepaliveConnection > Seconds between keepalivesSet to (0 is off). Stops idle drops; see Software caused connection abort
Auto-login usernameConnection > Data > Auto-login usernameSkips the prompt
Run a command after loginConnection > SSH > Remote commandReplaces the login shell; also set Session > Close window on exit to Never for one-off commands
Keep a shell after the commandSame field
Private keyConnection > SSH > Auth > CredentialsNeeds a ; convert with the PEM to PPK converter or make one with the PuTTY key generator
Session loggingSession > Logging > All session outputUse in the file name for one log per day
X11 forwardingConnection > SSH > X11 > Enable X11 forwardingNeeds VcXsrv or Xming running first; see Cannot open display
Port forwardingConnection > SSH > TunnelsSource port , destination , click Add
Bigger scrollbackWindow > Lines of scrollbackDefault is 2000; costs nothing noticeable
Local echo (serial, modems)Terminal > Local echo: Force onFor 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.

OptionWhat 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,N

There is no command line flag for keepalives. Set them in a saved session and open it with .

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.

CommandWhat 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.txt

pscp

pscp copies files between Windows and a server over SSH. Remote paths are .

CommandWhat 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.

CommandWhat 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.

SettingValue
Serial lineThe 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:

CommandWhat 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.

CommandWhat 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.

PuTTY FAQ

Does PuTTY use Linux commands?

PuTTY itself has almost no commands. It is a terminal window: whatever you type goes to the machine you connected to, so on a Linux server you use Linux commands (ls, cd, df -h, tail -f), on a Cisco switch you use IOS commands (show running-config), and on a modem you use AT commands. The only commands that belong to PuTTY are the putty.exe, plink, pscp, and psftp options you pass on the Windows command line.

How do I automate PuTTY commands?

Use plink, not the PuTTY window: nothing typed into the window can be scripted. plink -batch -i C:\keys\admin.ppk user@host "df -h" runs one command and prints the output, and -m commands.txt runs a whole file of them. Two flags matter for anything unattended: -batch makes plink fail instead of stopping on a prompt, and -hostkey SHA256:... stops the very first run from hanging on the unknown host key question. plink returns the remote command's exit code, so a scheduled task or batch file can test errorlevel and act on it.

How do I run a command automatically after login in PuTTY?

Put the command in Connection > SSH > Remote command and save the session. PuTTY runs it instead of a login shell and closes the window when it finishes, so for a one-off check like uptime also set Session > Close window on exit to Never. To land in a shell afterwards, use a remote command such as cd /var/log; exec bash -l. The field belongs to the saved session, so if you also want a plain shell on that host, save a second session under a different name rather than clearing the field each time.

How do I save in PuTTY?

It depends what you are saving. In nano, Ctrl+O then Enter writes the file and Ctrl+X exits. In vi or vim, press Esc first, then :w to save, :wq to save and quit, or :q! to leave without saving. On a Cisco or Aruba switch, write memory saves the running config so it survives a reload. To keep a copy of the session itself, turn on Session > Logging > All session output before you connect. Settings you change in the configuration window only stick if you go back to the Session panel and click Save on the session name.

How do I see command history in PuTTY?

History belongs to the shell on the server, not to PuTTY. Run history to list it, history | grep ssh to search it, press the Up arrow to step back through it, or Ctrl+R to search as you type. Rerun entry 42 with !42 and the last command with !!. For timestamps, add export HISTTIMEFORMAT='%F %T ' to ~/.bashrc; history -c clears the current session's list. The window's scrollback is separate: Shift+PgUp scrolls it, and Session > Logging writes everything to a file.

Related cheat sheets