PyMOL Commands Cheat Sheet: The Essential Reference for Structural Biologists
Quick referenceAll levels
Every PyMOL command you’ll reach for regularly — organized by task, not alphabetically. Bookmark this page and keep it open alongside PyMOL while you work.
How to use this reference
All commands are entered in the PyMOL command line at the bottom of the External GUI window. Arguments in [ ] are optional. selection can be any named selection, object name, or selection expression like chain A or resi 100-150.
Loading & fetching
Command
What it does
fetch 4XYZ
Download structure from RCSB PDB and load it
fetch 4XYZ, name
Fetch and assign a custom object name
load protein.pdb
Load a local PDB file
load traj.xtc, protein
Load an MD trajectory into an existing object
load_traj traj.dcd, protein
Alternative trajectory loading (DCD format)
delete all
Remove all loaded objects
delete object_name
Remove a specific object
reinitialize
Reset PyMOL to a completely clean state
Navigation & view
Command
What it does
zoom [selection]
Fit the view to the selection (or everything)
orient [selection]
Orient along principal axes of the selection
center [selection]
Center the view on a selection without zooming
reset
Reset camera to default position
get_view
Print the current view matrix — copy to reproduce later
set_view (matrix)
Restore a previously saved view matrix
turn x, 90
Rotate 90° around the x-axis (also y, z)
rotate x, 45, object
Rotate a specific object by 45° around x
clip near, -5
Adjust near clipping plane
clip far, 5
Adjust far clipping plane
Selections
The backbone of everything in PyMOL. Every command operates on a selection.
Command / syntax
What it does
Creating selections
select name, expression
Create a named selection from an expression
select site, chain A and resi 100-150
Select residues 100–150 of chain A
select pocket, byres (LIG around 5)
Select all residues within 5 Å of LIG
select iface, chain A and (byres chain B around 4)
Interface residues of chain A near chain B
Selection keywords
chain A
All atoms in chain A
resi 100-150
Residue numbers 100 through 150
resi 100+150+273
Specific residue numbers (use + to list)
resn LYS
All lysine residues (3-letter code)
name CA
Alpha carbon atoms only
elem C
All carbon atoms
hetatm
Heteroatoms (ligands, waters, ions)
resn HOH
Water molecules only
b > 70
Atoms with B-factor above 70 (pLDDT for AF)
Boolean operators
chain A and resi 100
Residue 100 in chain A specifically
chain A or chain B
Both chains A and B
not resn HOH
Everything except water
sel1 within 5 of sel2
Atoms in sel1 within 5 Å of sel2
byres (sel around 5)
Complete residues with any atom within 5 Å
Display modes
Command
What it does
show — add a representation
show cartoon [, sel]
Ribbon cartoon for protein backbone
show sticks [, sel]
All bonds as sticks — for residues and ligands
show lines [, sel]
Thin line bonds — lightweight background display
show spheres [, sel]
Space-filling (van der Waals) representation
show surface [, sel]
Molecular surface
show dots [, sel]
Dot surface (accessible surface area)
show mesh [, sel]
Wireframe mesh surface
show nb_spheres [, sel]
Non-bonded atoms as small spheres (ions)
hide — remove a representation
hide everything [, sel]
Remove all representations
hide cartoon [, sel]
Remove cartoon only
hide everything, resn HOH
Remove water molecules from view
as — show only this representation
as cartoon
Cartoon only — hides everything else
as sticks, selection
Sticks only for the selection
as spheres, resn LIG
Space-filling for ligand only
Coloring
Command
What it does
color red [, sel]
Single color — named colors: red, blue, green, white, slate, marine, wheat…
util.cbc [sel]
Color by chain — each chain gets a distinct color
util.cbs [sel]
Color by secondary structure (helix/sheet/loop)
util.cbaw [sel]
Color by atom type — classic CPK scheme, white carbons
util.cbag [sel]
Color by atom type — green carbons (ligand standard)
spectrum b, blue_red
Spectrum by B-factor (pLDDT in AlphaFold structures)
Save full PyMOL session (all objects, views, settings)
load session.pse
Restore a saved session
save output.pdb [, selection]
Export coordinates as PDB (optionally, just a selection)
save output.cif [, selection]
Export as mmCIF format
log_open commands.pml
Start recording all commands to a script file
log_close
Stop recording commands
@script.pml
Run a saved .pml script file
Useful settings
Setting command
Effect
set cartoon_fancy_helices, 1
Rounded ribbon helices — standard for publications
set cartoon_smooth_loops, 1
Smooth loop interpolation
set cartoon_tube_radius, 0.4
Thinner loop tubes (default 0.5)
set stick_radius, 0.15
Thinner sticks (default 0.25) — useful for ligands
set sphere_scale, 0.25
Smaller spheres (useful for ball-and-stick)
set ambient, 0.4
Ambient light level — higher = softer shadows
set specular, 0.3
Shininess — lower = more matte
set light_count, 4
Number of lights — more = smoother shading
set depth_cue, 0
Disable distance fog / depth cueing
set ray_shadow, 1
Enable shadows during ray trace
set antialias, 2
Anti-aliasing level for ray trace (1–4)
Quick workflows
New structure — starting sequence
fetch 4XYZ
as cartoon
hide everything, resn HOH
util.cbc
zoom
AlphaFold pLDDT coloring
load AF-P04637-F1-model_v4.pdb
as cartoon
spectrum b, blue_cyan_yellow_orange_red, minimum=50, maximum=100
bg_color white
Binding site figure
fetch 4XYZ
as cartoon
hide everything, resn HOH
color slate, protein
util.cbag LIG # green carbons for ligand
select site, byres (LIG around 5)
show sticks, site
show surface, site
set transparency, 0.4
zoom site
Publication figure export
bg_color white
set ray_opaque_background, 1
set cartoon_fancy_helices, 1
set ambient, 0.4
set specular, 0.3
ray 1200, 900
png figure1a.png, dpi=300
PyMOL doesn’t auto-save. Before closing, run save session.pse — the PSE file captures everything: loaded structures, selections, colors, measurements, and the current view. Loading the PSE later restores the exact state. Get in the habit of saving PSE files the way you save documents.
The 10 commands you’ll use every day
fetch · as cartoon · hide everything, resn HOH · util.cbc · select · color · show sticks · zoom · get_view · ray + png. Learn these ten cold and every other PyMOL task becomes a variation on a pattern you already know.
How to Show Protein Surfaces in PyMOL: Electrostatics, Hydrophobicity and Binding Pockets 12 min read Beginner to intermediate Surface representations communicate things that cartoon ribbons can’t — the shape of a binding pocket, the electrostatic character of an interface, which patches are hydrophobic. This guide covers every surface type in PyMOL, how to color them…
How to Install PyMOL for Free: Open-Source and Educational License Options (2026) 10 min read Beginner PyMOL is free for academic researchers — through either the open-source build or Schrödinger’s educational license. This guide covers every installation path: conda on any platform, Homebrew on Mac, the Windows installer, and the educational license. By the end…
PyMOL Scripting for Beginners: Automate Repetitive Tasks with Python 13 min read Beginner to intermediate If you’ve typed the same ten PyMOL commands more than twice, you’re ready to script. PyMOL’s scripting environment is Python — which means every Python skill you already have translates directly. This tutorial takes you from your first saved script…
PyMOL Selections: A Complete Guide with Examples 12 min read Beginner to intermediate Selections are the foundation of everything in PyMOL. Every command — coloring, showing, hiding, measuring, labeling — targets a selection. Master the selection syntax and every other PyMOL task becomes straightforward. Contents Anatomy of a selection command Core selection keywords Selecting by…
How to Make Publication-Quality Figures in PyMOL: Ray Tracing, Resolution and Journal Requirements 14 min read Beginner to intermediate The gap between a PyMOL screenshot and a journal-ready figure is smaller than most researchers think — but it requires knowing about five or six specific settings that are off by default. This tutorial covers every…
The Complete PyMOL Guide for Structural Biologists: Visualization, Analysis and Publication Figures 30 min read Beginner to intermediate PyMOL is the most widely used molecular visualization tool in structural biology — present on virtually every researcher’s laptop, featured in virtually every published structure paper. This guide covers everything: what PyMOL is, how to install it…