The following MARS requests can be used as a tutorial. The links into the MARS Catalogue might be helpful to create a valid retrieve script. However, the dates might need to be adapted.

As one can very easily retrieve large amounts of data it is best to start mars in a location where plenty of disk space is available, e.g. in $SCRATCH:

cd $SCRATCH

The solutions below provide valid MARS requests which can be passed to the mars command as

% mars < myrequestfile
                             or
% mars myrequestfile

Simple retrieves

Retrieve 1000,850,700 and 500 hPa temperatures from the 15th of February 1999 12 UTC Analysis  > see in MARS Catalogue 

retrieve,
    class    = od,
    type     = an, 
    expver   = 1,
    date     = 19990215,
    time     = 12,
    param    = 130.128, 
    levtype  = pressure level,
    levelist = 1000/850/700/500,
    target   = "t.grb"

Retrieve wind components valid for 5 days ago at 12:00 and 18:00 from forecast made 7 days ago at 12 UTC at all 137 model levels  > see in MARS Catalogue

retrieve,
    type     = forecast, 
    param    = 131/132, 
    levtype  = model level,
    levelist = 1/to/137,
    date     = -7,
    time     = 12,
    step     = 48/54, 
    target   = "wind"

Retrieve geopotential and surface pressure from analysis produced 2 days ago, analysis cycles (00,06,12,18)  > see in MARS Catalogue

retrieve,
    class   = od,
    type    = analysis,
    levtype = surface,
    date    = -2,
    time    = 00/06/12/18,
    param   = 129.128/134.128,
    target  = "all.an"

Retrieve surface pressure and surface long-wave (thermal) radiation downwards at every 12-hour time-step for the 12Z forecast from 12 days ago  > see in MARS Catalogue

retrieve,
    type    = forecast,
    param   = 134.128/175.128,
    date    = -12,
    step    = 12/to/240/by/12,
    time    = 12,
    levtype = sfc,
    target  = "sfc.grb"

Retrieve the operational monthly mean model level temperature (all levels) from the 06:00 analysis for February 1997  > see in MARS Catalogue

retrieve,
    class    = od,
    stream   = mnth,
    type     = analysis,
    time     = 06,
    date     = 19970200,
    levtype  = model level,
    param    = 130.128,
    levelist = 1/to/137, 
    target   = "monthly"

Retrieve the temperature on model levels 1, 2 and 3 for a week old 12 hour forecast. > see in MARS Catalogue

retrieve,
    type    = fc,
    date    = -7,
    time    = 12,
    step    = 12,
    levtype = ml,
    level   = 1/2/3,
    param   = 130,
    target  = "t_ml_1_2_3"

Time and step

Retrieve the 1000 hPa geopotential from two weeks old 12 UTC forecast (> see in MARS Catalogue) for:

ENS Overlap

Retrieve Total Precipitation, perturbed forecast overlap for 26th June 2023 (> see in MARS Catalogue)

retrieve,
class = od,
date = 2023-06-26,
expver = 1,
levtype = sfc,
number = 1/to/50,
param = 228.128,
step = 336,
stream = efov,
time = 00:00:00,
type = pf,
target = [stream]_[date].grb


See also FAQ: "How can I compute the accumulation using data from the overlap stream?"

Post-processing

Retrieve the 1000,500 and 300 hPa temperatures valid for day before yesterday at noon from the 12 UTC forecast of four days ago on an N48 Gaussian Grid  > see in MARS Catalogue

retrieve, 
class = od,
stream = oper,
expver = 1, type = forecast, param = 130.128, date = -4, time = 12, step = 48, grid = N48, levelist = 1000/500/300, levtype = pl, target = "t.gg.grb"

Retrieve the same on a latitude/longitude grid, 1.5 by 1.5 degrees. > see in MARS Catalogue

retrieve,
    class = od,
stream = oper,
expver = 1,
type = forecast,
param = 130.128,
date = -4,
time = 12,
step = 48,
grid = 1.5/1.5,
levelist = 1000/500/300,
levtype = pl, target = "t.ll.grb"

Retrieve Europe in the same way as in the previous retrieval. Compare the size of the resulting file with the previous one. > see in MARS Catalogue

retrieve,
    class = od,
stream = oper,
expver = 1,
type = forecast,
param = 130.128,
date = -4,
time = 12,
step = 48,
grid = 1.5/1.5,
levelist = 1000/500/300,
levtype = pl,
  area = e, target = "t.europe"

Retrieve the 1000 and 500 hPa geopotential for 1200 UTC analysis from two days ago in the formats below (one job for each form): > see in MARS Catalogue

Retrieve surface winds for previous week's 24 hour forecast on the European area converting to a 0.57 by 0.57 degrees latitude/longitude grid. > see in MARS Catalogue
What happens to the conversion?

retrieve,
    class=od,
    date=-7,
    expver=1,
    levtype=sfc,
    param=165.128/166.128,
    step=24,
    stream=oper,
    time=12:00:00,
    type=fc,    
area = europe, # As the area is not compatible with the grid,
grid = 0.57/0.57, # MARS will expand the area to make it fit.
target = "10u_10v"


Observations

Retrieve all the sea surface observations for the 1st February 2015.  > see in MARS Catalogue

retrieve, 
    type    = ob, 
obsgroup= con, obstype = ssd,
# obstype = 9/11/12/13/14/19/21/22/23/180/181/182,
    date    = 20150201, 
    time    = 00,
    range   = 1439,
    target  = "obs.bufr"

Ensemble forecasts

Retrieve the 2 metre temperature field of the first 10 members of a week old 12 UTC ensemble prediction (type: perturbed forecast) for 2, 3 and 4 days in advance > see in MARS Catalogue

retrieve,
class=od,
date=-7,
expver=1,
levtype=sfc,
number=1/to/10,
param=167.128,
step=48/to/96/by/24,
stream=enfo,
time=12,
type=pf,
target = "ensemble"

Retrieve the same for the control forecast. > see in MARS Catalogue

retrieve,
class=od,
date=-7,
expver=1,
levtype=sfc,
param=167.128,
step=48/to/96/by/24,
stream=enfo,
time=12,
type=cf,
target = "ensemble.cf"

ERA 5

Retrieve the vertical integral of eastward and northward heat flux as monthly means of daily means on a 1.125 by 1.125 degree latitude/longitude grid over Europe from the ERA 5 archive for January 2021 > see in MARS Catalogue

retrieve,
    class = ea,
    date = 20210101,
    decade = 2020,
    expver = 1,
    levtype = sfc,
    param = 69.162/70.162,
    stream = moda,
    type = an,
area = europe,
grid = 1.125/1.125,
target = "ea_moda_fluxes.grb"

Retrieval of snow depth from the ERA 5 archive for November 1993, for all analysis base times > see in MARS Catalogue. How many fields are requested?

retrieve,
  class   = ea,
  stream  = oper,
  expver  = 1,
  date    = 19931101/to/19931130,
  time    = 00/to/23,
  type    = an,
  levtype = sfc, 
  param   = 141.128,
  target  = "era5.199311.sd"
#                                  It retrieves 30 x 24 = 720 fields.


See also these Web API retrieve examples for ERA-Interim, S2S, TIGGE, ERA-20C etc.