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

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)

Keyboard Shortcuts

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

KeyAction
Left-click and dragSelect text, which copies it to the clipboard on its own
Right-clickPaste
Shift+InsertPaste
Ctrl+InsertCopy the current selection again
Double-click, triple-clickSelect a word, select a line
Shift+dragSelect text when a program (vim, htop) has taken over the mouse
Alt+dragRectangular selection
Shift+PgUp, Shift+PgDnScroll the window a page at a time
Ctrl+PgUp, Ctrl+PgDnScroll one line
Ctrl+CInterrupt the running command (not copy)
Ctrl+DSend end of file; on an empty prompt this logs out
Ctrl+ZSuspend the foreground job ( resumes it)
Ctrl+LClear the screen
Ctrl+RSearch command history as you type
Up, DownStep through previous commands
TabComplete a file name or command
Ctrl+A, Ctrl+EJump to start or end of the line
Ctrl+U, Ctrl+WDelete to start of line, delete the previous word
Ctrl+right-clickOpen 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 Cheat Sheet 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 copy and paste in PuTTY?
Selecting text with the left mouse button copies it to the Windows clipboard on its own; there is no copy step. Paste with a right-click or Shift+Insert. Ctrl+C does not copy in PuTTY, it interrupts the running command, and Ctrl+V types nothing. If a program such as vim or htop has grabbed the mouse, hold Shift while you drag to select. Ctrl+Shift+C and Ctrl+Shift+V can be turned on under Window > Selection if you prefer them.
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. To run a whole list of commands from a file, start PuTTY or plink with -m commands.txt.
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.
How do I download a file from the server with PuTTY?
Not from the PuTTY window itself. Open a Windows command prompt and use pscp, which installs alongside PuTTY: pscp user@host:/var/log/syslog C:\Users\you\Desktop\ copies one file, and pscp -r user@host:/var/www . copies a directory. Add -P 2222 for a non-standard port and -i key.ppk for key authentication. For a browsable session, run psftp user@host and use get and put.

Related cheat sheets