PodcastsEducationHacker Public Radio

Hacker Public Radio

Hacker Public Radio
Hacker Public Radio
Latest episode

288 episodes

  • Hacker Public Radio

    HPR4668: Nuclear Power Technology Follow Up on Safety

    24/06/2026
    This show has been flagged as Clean by the host.

    --------------------







    01 Introduction







    This is the second follow up to my 8 part series on nuclear power. In this episode I will attempt to answer a question posed by brian in ohio in a comment on HPR4583. In that comment he said:







    02



    --------------------







    Loving this series. Maybe Whiskey Jack could give some cost comparisons between large and small reactors. He could also give us a realistic look at nuclear plant safety/accidents compared to conventional power production. Looking forward to the episode on FORTH generation reactors ;-)







    --------------------







    03



    End of quote.







    The first question I answered in my previous follow up, which was HPR4628. In this episode I will attempt to answer the second question, which was about the safety of nuclear power compared to other sources of electrical power generation.







    One of the HPR janitors encouraged me to make this episode, so I think we can thank him for getting another HPR episode made.







    04 Defining the Scope



    First, let's define the scope of the question.







    This will cover electrical power generation only.



    Within that scope I will consider only the following sources of energy.







    05



    Coal



    Oil



    Natural Gas



    Hydroelectric



    Nuclear



    Wind



    Solar







    I won't cover geothermal, wave, or tidal power as these are only used in very small amounts and so there simply isn't enough literature on them to base a discussion on .







    06 Foreshadow Conclusion



    I should mention right away that I cannot provide absolute answers to this question in the form of a nice, neat ranking table based on numbers from peer reviewed scientific sources.



    The reasons for this will become apparent, but to put it briefly, the data on which to base such a ranking simply doesn't exist.







    I will however provide context within which people can think about the issue.



    Wherever possible, I will provide links to the references that I used in the show notes so you can read further on this yourself.







    --------------------







    07 Energy Catastrophism versus Energy Uniformitarianism







    First though I need to go off on a slight geological detour in order to explain an important analogy that I will use.







    08



    In the 19th century there was a great debate among geologists over what is known as catastrophism versus uniformitarianism.



    In seeking to explain the origins of the earth and of the landscape that we see around us, there were two points of view.







    09



    One was "catastrophism".



    This is the belief that the mountains, valleys, and plains that we see around us were formed as a result of great catastrophes which occurred relatively recently in earth's history.



    This explanation was necessary in order to fit geological features into an earth that was believed to be only a few thousands of years old.



    This view was heavily influenced by religious belief.



    In this view Noah's flood was the great catastrophe and the fossils of dinosaurs were the remains of animals who had not been saved on the ark and so had died in the flood.







    10



    The other point of view was uniformitarianism.



    This was the hypothesis that the landscape we see around us can be explained by the very slow accumulation of very small changes over very long periods of time.



    For this to be true however, the earth had to be far older than the few thousand years that a literal reading of the bible would suggest.



    The earth in fact had to be many, many, millions of years old.







    11



    Eventually, the uniformitarian view won out and people understood that while some catastrophes can take place, the shape of the landscape is overwhelmingly due to small changes over very long periods of time.











    12 How is this Relevant to this Episode You Ask?



    How this is relevant is that I will use this analogy to explain how we need to think about energy and safety.



    Very small numbers of deaths and injuries multiplied over many occurrences can add up to big numbers, comparable in scale or possibly even larger than a single catastrophe or even several of them.







    13



    I don't know if anyone else has used this analogy before, I have just thought of this when writing the script for this podcast.



    None the less, I think it is a very useful way of helping to understand the issues.







    14



    As an example of this, think about the well known case of the safety of flying versus the safety of travelling in your car.



    Air crashes are catastrophes that make the headlines.



    Automobile crashes are seldom more than local news at best.



    You have probably heard many times the claim that if you making a trip somewhere, you are safer to fly than to drive yourself in your car.











    15 Example - Hydro versus Solar



    I will now present an example of this.



    Hydro electric power has some notable large scale catastrophes associated with it.



    Roof top solar power does not have any notable catastrophes that I am aware of.



    However, which is safer?







    16 Hydro Catastrophes



    Here are three examples of hydro electric catastrophes in just one country, Italy.







    The Vajont Dam which collapsed in1963



    An estimated 1,917 to 2,500 people died.







    The Sella Zerbino dam which collapsed in 1935.



    More than 100 people died.







    The Gleno Dam which collapsed in 1923.



    An estimated 350 people died.







    https://damfailures.org/



    https://pmc.ncbi.nlm.nih.gov/articles/PMC4997708/







    17



    I haven't tried to compile a global list of the worst hydro electric dam collapses, as this sort of information is actually very difficult to find, even on web sites dedicated to dam failures.



    An additional problem is that information on whether a dam was used for electric power generation or not is often not available.







    18



    Dam failures where contradictory or insufficient information is available on whether there was an associated hydro power plant include the 1975 Banqian Dam failure, where death estimates range up to a quarter of a million.







    19 Solar Panel Slow Accumulation



    Contrast this with roof top solar panels.



    Many small accidents can add up to big numbers as well.







    20



    Health and safety literature discussing solar panel safety mention things such as



    Falls from roofs.



    Electric shock.



    Arc flash (burns from electrical arcing).



    Normal electrical safety procedures which are based around locking out sources of energy do not work with solar panels which makes safety more difficult.



    Heat stress due to working exposed in the hot sun.







    Warning from US government on falls by solar panel installers.



    https://stacks.cdc.gov/view/cdc/228946



    https://www.osha.gov/green-jobs/solar











    21 Why We Cannot Compare the Two



    Hydro catastrophes are not well documented, but we can at least find records of some of the most notable ones.



    However, even those have very large variations in estimates of deaths.







    22



    Roof top solar deaths however are largely undocumented.



    The industry is largely unregulated.



    There is no central authority which accumulates many individual deaths or injuries.



    At best there are worker and public safety bodies who simply accumulate those statistics into general construction or household injuries.







    23



    Thus we have no reliable means of comparing the two energy sources on a comparable basis.



    We face the same problem with all other major electrical energy sources.



    So far as I am aware, there are no peer reviewed scientific studies which compare the relative safety of all of the major electrical energy sources we are considering here based on actual numbers.











    --------------------







    24 Safety Risks







    I will now try to list some the major hazards for each of energy sources we are considering.



    There is however limited data available.



    In many cases we just have reference to worker safety organizations as to what the hazards are.



    I will not attempt here to put numbers to these here.







    Categories







    25 Coal, Oil, Natural Gas



    The hazards are



    Air pollution



    Mining and oil field accidents



    Pipeline explosions



    Transportation accidents. These- move a lot of material so these are significant.







    26 Hydroelectric



    These include



    Dam collapse



    Drowning







    27 Nuclear



    These include



    Radiation exposure







    28 Wind



    These include



    Falls



    Confined space deaths (there is not much detail on this)



    Electric shock



    Ice throws (that is, throwing pieces of ice off the blades)



    This technology has a significant problem with people working alone which greatly increases risks associated with other dangers.







    29 Solar



    These include



    Falls



    Electric shock



    Arc flash



    Heat stress







    30



    I have not tried to cover all possible risks associated with each category, just the ones which each industry considers to be the risks they concern themselves with.



    There does not exist any means by which risks of similar types are compared across different industries.







    31 Reliability of Supply is Also Safety



    In a completely electrified net zero society, reliability of supply is a safety matter.



    People will die in very large numbers in cold climates if they do not have heat.



    If we have no fossil fuels, we need to also consider how reliably does a grid based on any of the options work.



    I have not seen anyone attempt to address this question and will not attempt to address it here.



    However, it must be addressed in any comprehensive attempt to rank safety.







    --------------------







    32 Studies or Articles on Estimates of Relative Safety







    Despite the difficulties of comparing the safety of different sources of energy, some people have attempted this anyway.



    Different estimates done at different times had different focuses, so unfortunately we do not have a nice set of studies that we can neatly use to cross check one another.



    I will however list the names and the authors and summarize the results.







    --------------------







    33 The Health Hazards of Not Going Nuclear



    By Dr. Petr Beckman



    Published in 1976







    The author of this book tried to address the relative safety of different sources of energy in the mid 1970s.



    However, it is old at this point, so I won't bother digging through its pages to find his figures.







    34



    He mainly focused on comparing electric power generated with coal to nuclear.



    His conclusion was that if the goal was to prevent deaths or ill health in the process of generating electricity, then the logical conclusion was to replace coal fired power plants with nuclear.







    35



    The book was relatively well known at the time, as least as far as books on energy are concerned, so I thought it was still worth mentioning.



    I happen to have a copy of this book which I bought back in that time period



    It was the 8th printing of the book, so it would appear to have had relatively good sales.







    36



    The author did address the issue of what I have termed "catastrophism" in his comparison of different energy sources, although I don't know if he used this phrase.



    I don't know if he was the first to use this sort of analysis, but he certainly was very influential in terms of popularizing it.











    --------------------







    37 Risk of Energy Production



    by Herbert Inhaber



    Publication AECB 1119



    March 1978







    This study is a scientific paper from the same time period as the book "The Health Hazards of Not Going Nuclear".







    38



    He based his risk estimates largely on estimates of the amount of material which was used in the construction and operation of various power sources.



    While we could argue over whether or not this is a valid methodology, I think any such argument would be pointless as I think the age of the study alone renders it not relevant today anyway.



    Advancements in materials have changed the basis results significantly by now.



    However, as it exists I thought I would mention it to show that the idea of comparing energy sources to each other is not a new one.



    The author compared a wider variety of potential sources than Beckman did.







    39



    Here's his conclusions.



    He assumes equal amounts of energy produced by each method.



    The numbers are normalized such that the total sums to 100%.



    You can think of it in terms of what proportion of total deaths or injuries would result from each source if each were equally used.







    40



    Coal 27.5%



    Oil 25.6%



    Methanol 16.7%



    Wind 10.8%



    Solar photovoltaic 9.2%



    Thermal 8.1%



    Solar space heating 1.5%



    Ocean thermal 0.4%



    Nuclear 0.13%



    Natural Gas 0.08%







    41



    His natural gas estimate is drastically different from that of other authors.



    I am not going to worry about explaining it however, as the study is as I said old enough to be not very relevant anyway.



    I am mainly including this here out of historical interest.







    42



    As a footnote, the methanol he refers to would be synthesized from wood. This was a popular idea in that era as a means of providing liquid fuels for transportation. Practical battery electric cars in those days were strictly science fiction.







    43



    The ocean thermal category is a real blast from the past and I had forgotten all about that concept.



    It was a very popular idea at that time and was supposed to be *the* big and upcoming thing in renewable energy.



    It involved various means of attempting to extract energy from differences in water temperature at different depths in the ocean.



    It gradually faded away however, as despite great efforts being put into it, designs never proved to be practical.











    --------------------







    44 Electricity generation and health



    Anil Markandya, Paul Wilkinson



    Published in the Lancet, Vol 370, 15 September 2007







    45



    This is more recent than the previous one, although it is nearly 20 years old at this point.



    Unfortunately it doesn't cover wind or solar, just fossil fuels and nuclear.



    However it is still useful, and the Lancet is a very reputable peer reviewed journal.







    46



    I will present just the results rather than discussing the whole paper.



    The authors break it down into deaths among the public, occupational deaths, and air pollution related deaths, serious illness, and minor illness.







    47



    They break the energy sources down into lignite, coal, gas, oil, biomass, and nuclear.



    Lignite is a type of very low grade coal used mainly for electric power generation.



    In this paper biomass refers to energy crops and forest residues.







    48



    I will summarize the results by category rather than trying to describe a table that has 6 rows and 5 columns.







    All numbers are normalized in terms of deaths or cases per TWh.







    49



    Occupational deaths from accidents



    lignite 0.1



    coal 0.1



    gas 0.001



    oil no data



    biomass - no data



    Nuclear is 0.019.







    50



    Deaths among the public from accidents



    lignite 0.02



    coal 0.02



    gas 0.02



    oil 0.03



    biomass no data



    Nuclear 0.003







    51



    Air pollution deaths



    lignite 32.6



    coal 24.5



    gas 2.8



    oil 18.4



    biomass 4.63



    Nuclear 0.052







    52



    Air pollution serious illnesses



    lignite 298



    coal 225



    gas 30



    oil 161



    biomass 43



    Nuclear 0.22







    53



    Air pollution minor illnesses



    lignite 17,676



    coal 13,288



    gas 703



    oil 9,551



    biomass 2,276



    Nuclear no data







    54



    Natural gas edges out nuclear power slightly in terms of occupational safety, but in every other category nuclear is drastically lower in terms of ill effects than any of the alternatives.







    --------------------











    55 2020 Fatalities for US Roofers Increased 15% as Solar Roof Installations Increase



    Published in The Next Big Future



    July 6, 2021 by Brian Wang







    56



    This seems to be written by someone who has a popular science blog.



    I'm not familiar with it personally, but he addresses the subject so I'll list it.







    The title implies that it's all about rooftop solar, but he provides comparative numbers for the other energy sources of interest, so that is useful for our purposes.



    However, he doesn't describe his methodology, so we need to treat them with some caution.







    Here are his results



    These are deaths per thousand terawatt hours.







    57



    Coal - 100,000



    Oil - 36,000



    Natural gas - 4,000



    Hydro - 1,400



    Rooftop solar - 440



    Wind - 150



    Nuclear - 90







    58



    If we plot these numbers on a bar chart, coal and oil are so large that all of the others are squished to the bottom of the chart and are difficult to see at all.







    Let's therefore look at these in terms of orders of magnitude.



    Keep in mind that this is a logarithmic scale.



    This means that the difference between 4 and 5 is much greater in linear terms than the difference between 1 and 2.







    59



    Coal - 5



    Oil - 4



    Natural gas - 3



    Hydro - 3



    Rooftop solar - 2



    Wind - 2



    Nuclear - 1







    60



    Each of these numbers represents an order of magnitude, that is a power of ten.



    We can see that with rooftop solar, wind, and nuclear, the numbers are so close and the uncertainties are so great and their relative values so small compared to say coal that they can be seen as equivalent so far as safety is concerned.







    --------------------







    61 What are the safest and cleanest sources of energy?



    by Hannah Ritchie



    Published in Our World in Data



    First published in 2017, updated in 2022 and 2024







    62



    The author of this study addressed both deaths and greenhouse gas emissions.



    Deaths from accidents and air pollution are normalized to per TWh of electricity, while greenhouse gas emissions are normalized to GWh of electricity over the life cycle of the plant.







    63



    Here are the death figures.



    Coal 24.6



    Oil 18.4



    Biomass 4.6



    Natural Gas 2.8



    Hydro power 1.3



    Wind 0.04



    Nuclear 0.03



    Solar 0.02







    64



    For greenhouse gas emissions the figures are



    Coal 970 tons



    Oil 720 tons



    Natural gas 440 tons



    Biomass 78 to 230 tons



    Solar 53 tons



    Hydro power 24 tons



    Wind 11 tons



    Nuclear 6 tons







    65



    If we take the death figures and rank them by order of magnitude as we did with the previous article, we get the following.







    66



    Coal - 4



    Oil - 4



    Biomass - 3



    Natural Gas - 3



    Hydro power - 3



    Wind - 1



    Nuclear - 1



    Solar - 1







    67



    Keep in mind that the previous article covered only rooftop solar and not large industrial installations, and so is not directly comparable.



    Also the units are different, with the previous article being in terms of thousand TWh, and this one being in TWh.



    If we exclude solar (as the numbers are not comparable), Brian Wang's numbers are between 1.5 to 4 times higher than Ritchie's, except for hydro which are almost identical. I think this latter is due to both sets of numbers are dominated by one exceptionally big hydro accident.







    68



    Overall however, the relative rankings are quite comparable.







    Ritchie's numbers for deaths from coal, oil, and natural gas appear to be directly from the study by Markandya and Wilkinson mentioned above.







    For the benefit of those who are wondering, Ritchie specifically states that her numbers for nuclear include the Chernobyl and Fukushima accidents.







    --------------------











    https://www.iaea.org/publications/magazines/bulletin/21-1/solar-power-more-dangerous-nuclear



    Direct link to file



    https://www.iaea.org/sites/default/files/publications/magazines/bulletin/bull21-1/21104091117.pdf







    https://ourworldindata.org/safest-sources-of-energy







    https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(07)61253-7/abstract







    https://www.nextbigfuture.com/2021/07/2020-fatalities-for-us-roofers-increased-15-as-solar-roof-installations-increase.html







    --------------------







    69 Conclusion from Studies







    Remember that in engineering terms, when comparing groups of numbers which contain both both very small numbers and one or more very large numbers, the differences between the small numbers are often not significant.



    The differences between the small numbers may be the product of our ability to measure these things rather than any real differences.







    70



    For example, in the article by Ritchie wind power would appear to be twice as dangerous as nuclear.



    However, the difference between them is 0.02 compared to 24.6 for coal.



    In other words, the difference between apparently "dangerous" wind and apparently "safe" nuclear is equivalent to 0.08% of the total for coal.



    It's therefore meaningless and a red herring to even worry about.







    71



    With the above taken into consideration, generally the different sources of energy fall into two broad categories in terms of number of deaths, injuries, and illnesses.



    The fossil fuels and biomass fall into one group and wind, solar, and nuclear into another group.







    72



    Hydro power would seem to fall into the higher risk category or at least somewhere between the two, but this I suspect is mainly due to one exceptionally large dam collapse in China, the Banqian Dam failure in 1975.



    This is mentioned as being specifically included in the article written by Ritchie.



    This was a multi-purpose dam, and information on this dam is difficult to find.



    It is not clear to me whether it had a hydro electric generator associated with either it or another dam that was part of the same system.







    73



    Some people therefor may argue for its exclusion from the numbers.



    Of course some people may argue for its inclusion anyway, as it was a dam regardless of whether it actually had an electric generator attached.



    If we exclude it, then I think the numbers for hydro power would fall into the same range as for nuclear, wind, and solar.







    74



    Most people would consider hydro power to be safe and clean enough regardless of this and I will rank it as such in any conclusions that I come to.



    As you can see, even if we have numbers, it can be a matter of opinion as to how to interpret them.











    --------------------







    --------------------







    75 Taking a Systems Approach







    Now let's take a look at the broader energy picture today and into the future.



    Many countries in many parts of the world have committed to the concept of "Net Zero", which means eliminating carbon emissions on a net basis.



    Net zero essentially means the complete electrification of society.



    We must therefore have electrical energy on demand and at low cost.



    We must as a result of this look at complete electrical systems rather than individual sources in isolation.







    76



    At one time many electrical systems were entirely coal or entirely hydroelectric.



    This is no longer the case.



    There are now major amounts of wind and solar involved in many countries.



    However these are inherently intermittent.



    This means that other sources of energy are inherently also required to have a functional system.







    77



    If any particular solution inherently requires fossil fuels to meet part of the demand, then the safety, pollution, and climate issues relating to those fossil fuels have to be factored in to that complete system when trying to come up with a relative ranking.







    Talking about Individual sources in isolation are therefore meaningless in these countries.







    78



    There are battery systems, but these are mainly used to stabilize and regulate the grid plus to a lesser degree to smooth out short term daily peaks in demand.



    They do not have the ability to store large amounts of electricity on a large scale for an entire grid for days, weeks, and months to make up for intermittency.







    79



    So a serious attempt to rank sources of energy would need to look at a variety of representative countries and for each one come up with a plan that involves 'x' megawatts from source 'a', 'y' megawatts from source 'b', etc., and total up the values for each.







    80



    I am not aware of anyone who has studied this larger issue.



    However, the problem has to be addressed from this perspective in order for any answer to be useful.



    Not taking this into account is like ordering a diet soft drink to go with with a high calorie meal and assuring yourself that your plans to diet are fine.







    81



    This is not to imply there is anything inherently wrong with wind or solar.



    It does mean that if your goal is to achieve both net zero and a clean environment, you have to look at your entire energy system as a complete system rather than focusing on what you feel are the most reassuring parts of it while ignoring the rest.







    This does however add to the argument that it is in fact inherently very difficult to come up with a system of ranking energy sources for safety.











    --------------------







    82 Nuclear, Climate, and Clean Air - Contrasting Examples







    To give a tangible example we will now look at two different places that followed two divergent paths at roughly around the same time frame.







    These are the province of Ontario in Canada, and Germany.







    83



    Ontario had a mix of coal, hydro electric, and nuclear generating plants.



    Germany had a mix of coal, nuclear and natural gas plants.







    Ontario shut down their coal fired plants and kept their nuclear plants.



    Germany however shut down their nuclear plants and kept their coal fired plants.











    84 The Phase Out of Coal in Ontario







    In 2003 Ontario decided to close all of its coal fired generating plants, which consisted of 19 units (that is boilers and turbines) totalling 8,800 MW.



    This phase out was completed by 2014.







    85



    Here are the figures for amount of power generated by each energy source in 2003 and 2014.



    Nuclear went from 42% to 60%



    Hydro went from 23% to 24%



    Gas went from 11% to 9%



    Coal went from 25% to 0%



    Non-hydro renewable went from 0% to 7%.







    86



    As you can see, the bulk of that replacement came from increased use of nuclear power.



    Furthermore, this did not result in simply replacing coal with natural gas.



    While gas is cleaner than coal, it still has emissions and if you recall from the studies that we looked at earlier, had an estimated death rate roughly 2 orders of magnitude greater than nuclear, solar, or wind.







    87



    To put this in more practical terms, at one time Toronto regularly had clouds of smog obscuring it, to a large extent due to these coal fired power plants







    With the phase out of coal, smog days went to zero in 2015 compared to 53 a decade earlier.







    The 2023 figures for Ontario show carbon emissions of 53 grams per kWh of electricity generated.



    We can use this as a rough benchmark comparison for total emissions.











    88 The Phase out of Nuclear in Germany



    Until March of 2011, Germany generated one quarter of its electrical power from nuclear.



    Starting in 2011 however, they began shutting down their nuclear power plants.



    These were then phased out over the next decade.



    However, the coal plants were to be kept to 2038.



    In 2026 Germany began talking about increasing use of coal in order to save gas.



    In the same year the German chancellor Friedrich Merz stated that the phase out of nuclear was a



    quote “serious strategic mistake”.



    EU Commission President Ursula von der Leyen said it was "a strategic mistake for Europe to turn its back on a reliable, affordable source of low-emissions power".







    89



    I won't go into the details of the phase out, but let's look at some emissions numbers for Germany.



    If we look at the official numbers from the European Environmental Agency for 2024, for Germany their emissions were 298 grams per kWh of electricity generated.







    Recall that we are using emissions as a very rough guide to amount of air pollution, and that this has a direct effect on the safety of the overall electrical energy system.







    90



    So, who actually made their people safer, Ontario who phased out their coal plants and kept their nuclear plants, or Germany who phased out their nuclear plants and kept their coal plants?







    91



    If you want a comparison directly within Europe, then Germany has one of the highest rates of emissions per kWh of electricity generated, whereas France, who use mainly nuclear power, have one of the lowest at 43 grams per kWh of electricity generated.







    Again, who is making their people safer, Germany or France?







    92



    I don't want to make it sound like I am picking on Germany.



    I am also not going to tell them how they ought to run their country.



    However they provide a good real world example of how we need to look at things in overall context when we are thinking about the choices that we make.











    https://www.ontario.ca/page/end-coal



    https://www.cbc.ca/news/canada/windsor/smog-study-shows-significant-decreases-in-pollutants-in-ontario-1.4151183







    https://www.eea.europa.eu/en/analysis/indicators/greenhouse-gas-emission-intensity-of-1



    https://world-nuclear.org/information-library/country-profiles/countries-g-n/germany







    https://www.politico.eu/article/friedrich-merz-is-right-to-reject-germanys-nuclear-phase-out-says-iea-chief-fatih-birol/







    https://www.politico.eu/article/germany-considers-ramping-up-coal-power-to-avert-energy-crisis/







    https://www.iea.org/countries/estonia/electricity



    https://www.iea.org/countries/malta/electricity











    --------------------







    93 Conclusions



    As we can see, there don't appear to be an abundance of peer reviewed scientific studies that we can simply point to in order to answer the question of safety of all possible major different energy sources once and for all.







    Collecting the data to even attempt to answer the question is inherently very difficult as we cannot readily conduct experiments to answer the question, and sources of data are not collected or consolidated in a manner which can answer this question adequately.







    94



    The essence of the problem is that most energy industries are not as tightly regulated and monitored to the same degree that say nuclear power or commercial airliners are, so this data is simply not being systematically recorded.







    However, a number of people have attempted to make estimates.







    95



    Their conclusions would seem to be that nuclear, wind, and solar are roughly equivalent in terms of safety.



    All fossil fuels are much less safe than nuclear, wind, and solar, by as much as several orders of magnitude.







    96



    We can however say with a reasonable degree of certainty that if a country shut down their nuclear power plants and kept their fossil fuel plants, particularly coal, then they probably made their people less safe than if they had done things the other way around.







    97



    I hope that I have provided some context in which to think about the issue.







    Thanks again to brian in ohio for providing the question upon which this episode is based.







    --------------------





    Provide feedback on this episode.
  • Hacker Public Radio

    HPR4667: UNIX Curio #9 - printf

    23/06/2026
    This show has been flagged as Clean by the host.

    This series is dedicated to exploring little-known—and occasionally useful—trinkets lurking in the dusty corners of UNIX-like operating systems.


    The
    echo
    command is very useful—it prints the arguments given to it, followed by a newline character. (The newline is sometimes also called a linefeed character depending on who is writing or speaking, and has the ASCII decimal value 10.) It has many uses, either in a script or interactively on the command line. The
    echo
    utility is used to display text, the value of a variable, or the result of a pathname expansion. It can also feed text to another command in a pipeline.



    As useful as
    echo
    is, it should come as no surprise that it
    first appeared early on in Bell Laboratories' Second Edition UNIX


    1
    in 1972. This
    initial version accepted no options


    2
    —although the manual page doesn't explicitly say output is followed by a newline character, the description of writing "as a line" seems to imply it. In
    Seventh Edition UNIX, the manual page


    3
    makes that clear, and also features the addition of the
    -n
    option, which causes
    echo
    to print the arguments
    without
    a trailing newline character.
    Eighth Edition UNIX's




    echo




    4
    gained the
    -e
    option, which allows certain escape codes from the C programming language to be used.



    These variations caused differences in behavior between different versions of
    echo
    . Will running
    echo -n something
    on your system output the text "something" without a newline, or "-n something" followed by a newline? Things get even trickier when the command arguments include parameter or pathname expansions. If there are files named "-n" and "something" in the current directory, what does
    echo *
    output? Like the previous question, that depends on whether or not your version of
    echo
    treats
    -n
    as an option. You can't get around this ambiguity by quoting or escaping the "*", because that just causes
    echo
    to print a literal asterisk.





    Example using GNU utilities on Debian 12; both the "echo" utility and the "echo" builtin of bash recognize "-n" as an option.




    $ ls -1
    -n
    something
    $ echo *
    something$ #Shell prompt is on the same line because "-n" was treated as an option to echo
    $ echo "*"
    *



    The solution was to create a new utility, which is the first UNIX Curio for today:
    printf
    . This command allows a user to print text similar to the way the identically-named function works in the C programming language. You
    run




    printf




    5
    followed by a format string, followed by zero or more arguments. No newline characters are printed unless specifically indicated by the format string or the arguments.



    To use
    printf
    to print "something" without a newline, that would just be
    printf something
    . This demonstrates that you don't need any arguments—in this example, the format string is just a set of regular characters to be displayed. If you wanted a newline character at the end,
    printf "something\n"
    would give you that. (In this case, the format string needs to be quoted so the "\n" isn't interpreted by the shell.) In addition to "\n" for a newline, you can also use "\a" for an alert (rings the terminal bell), "\b" for a backspace, "\f" for a formfeed, "\r" for a carriage return, "\t" for a horizontal tab, "\v" for a vertical tab, and "\\" to get a literal backslash. In addition to these special characters, any arbitrary byte can be included using a backslash followed by one to three octal digits; however, it might be difficult to predict what will be output because it can differ based on the character set the terminal is using. It is safer and more portable to stick to the pre-defined characters if possible.



    The
    real
    magic of the
    printf
    utility comes from using "conversion specifications" in the format string. Probably the simplest of these to explain is the "%s" conversion specification—it represents a string of any length. The command
    printf "Hi, %s, how are you?\n"
    followed by a list of names would print the greeting for each name, putting it in the place occupied by the "%s".



    $ printf "Hi, %s, how are you?\n" Alice Bob Carol
    Hi, Alice, how are you?
    Hi, Bob, how are you?
    Hi, Carol, how are you?



    The format string is reused as many times as needed to consume all of the arguments. Take, for example, the command
    printf "Hi, %s, have you met %s?\n"
    . If this is run with two name arguments, it would print the sentence on one line, using both names. If run with four name arguments, it would print the sentence twice, once with the first two names and again with the second two names. If you only gave it three names, the last "%s" conversion specification would be replaced with a null string.



    $ printf "Hi, %s, have you met %s?\n" Alice Bob
    Hi, Alice, have you met Bob?
    $ printf "Hi, %s, have you met %s?\n" Alice Bob Carol David
    Hi, Alice, have you met Bob?
    Hi, Carol, have you met David?
    $ printf "Hi, %s, have you met %s?\n" Alice Bob Carol
    Hi, Alice, have you met Bob?
    Hi, Carol, have you met ?



    Three other items can also be given in each conversion specification: flags, the field width, and the precision. The exact meanings of these depend on which type of conversion specifier character you are using. For "%s", using a "-" as the flag causes the text to be left-justified instead of the default right-justified, a field width causes the printed field to be at least as long as the number given, and a precision limits the number of bytes written from the string to the number given.



    $ #Example of %s with a precision value
    $ printf "Hi, %.3s, how are you?\n" Alice Bob Carol
    Hi, Ali, how are you?
    Hi, Bob, how are you?
    Hi, Car, how are you?
    $ #Example of %s with a field width
    $ printf "Hi, %8s, how are you?\n" Alice Bob Carol
    Hi, Alice, how are you?
    Hi, Bob, how are you?
    Hi, Carol, how are you?
    $ #Example of %s with a left-justify flag and a field width
    $ printf "Hi, %-8s, how are you?\n" Alice Bob Carol
    Hi, Alice , how are you?
    Hi, Bob , how are you?
    Hi, Carol , how are you?
    $ #Example of %s with a left-justify flag, a field width, and a precision
    $ printf "Hi, %-8.3s, how are you?\n" Alice Bob Carol
    Hi, Ali , how are you?
    Hi, Bob , how are you?
    Hi, Car , how are you?



    While "%s" is probably the most commonly-used conversion specification, others are available. A whole set of them are dedicated to printing integer values as a signed decimal, an unsigned decimal, an unsigned octal, or an unsigned hexadecimal number. These also can take flags, a field width, and a precision. I think the details and nuances of all this are too complex to clearly explain here, so I will just refer you to the
    POSIX "file format notation" specification


    6
    .



    Be aware that unlike the
    printf
    function in the C programming language, the
    printf
    utility is
    not
    obligated to accept conversion specifications for floating-point numbers. While some implementations might support this, scripts intended to be portable should limit themselves to the restricted set required by the POSIX standard (%d, %i, %o, %u, %x, %X, %c, and %s, plus %b and %% described below).



    Two more conversion specifications are worth mentioning. The first is
    only
    required by the standard for the
    printf
    utility, not the C function, and is "%b". This is the same as "%s", except that certain backslash escape sequences in the argument will be treated specially. This includes all the ones described above
    except
    for the one using octal digits to represent a byte. In an argument, this is instead represented by "\0" followed by one to three octal digits. An additional backslash escape sequence accepted is "\c"—this does not print anything itself, but causes
    printf
    to immediately halt output.



    The final conversion specification is "%%", which just outputs a literal "%". You can't use a bare "%" in the format string, because
    printf
    expects that to introduce a conversion specification. Be careful not to be tripped up by this when trying to print some value as a percentage.





    Example assuming that the hypothetical "/dev/batterycharge" file on your laptop outputs the battery charge level (42% in this case). As you can see, in some cases an error message might be displayed, but in others it might just behave in a way you didn't intend without complaining. GNU's "printf" utility and the "printf" builtin of bash both support "%e" as a conversion specification as an extension to POSIX.




    $ cat /dev/batterycharge
    42
    $ #Wrong
    $ printf "Your laptop's charge level is $(cat /dev/batterycharge)%.\n"
    bash: printf: `\': invalid format character
    Your laptop's charge level is 42$ #Shell prompt appears here from the error
    $ #Right
    $ printf "Your laptop's charge level is $(cat /dev/batterycharge)%%.\n"
    Your laptop's charge level is 42%.
    $ #Next one treats %e as the specifier, with the space and "l" as flags
    $ printf "Your laptop has $(cat /dev/batterycharge)% level of charge.\n"
    Your laptop has 42 0.000000e+00vel of charge.
    $ #Because no arguments were given, "0" was used for the value to convert



    Let's go back to the situation I was describing with
    echo
    —we have files named "-n" and "something" in the current directory and want to print all their names, separated by spaces. We could do that with
    printf "%s " *
    , which would not treat the "-n" as an option. However, the output might look a little weird because there wouldn't be a newline character at the end. We could insert a newline by using "%b" instead of "%s" and following the asterisk with a "\n\c" as the second argument. The "\c" is there to prevent the final space in the format string from being printed after the newline.



    $ ls -1
    -n
    something
    $ printf "%s " *
    -n something $ #No newline was printed here
    $ printf "%b " * "\n"
    -n something
    $ #There's a newline, but also a spurious space before the shell prompt
    $ printf "%b " * "\n\c"
    -n something
    $ #No space before the shell prompt this time



    Using the "%b" conversion specification can therefore solve one problem, but it also introduces another. Arguments which include a backslash can be interpreted as escape sequences, and many systems are fine with allowing backslashes in filenames. In cases where you're just using the
    printf
    utility to
    display
    text, it's usually not a big deal if the output looks a little wonky. Where you really need to be careful is when the text is being piped to another program, as control characters and other oddities might cause unexpected results, and can potentially create security problems if processed by a script or utility running as a privileged user.



    $ #GNU "ls" displays filenames containing a backslash in single quotes
    $ ls -1
    apple
    banana
    '\cherry'
    durian
    $ printf "%b " * "\n\c"
    apple banana $ #"\c" in "\cherry" stops output immediately



    The
    printf
    utility
    looks to have shown up first in 1986's Ninth Edition UNIX


    7
    , though the
    earliest manual page I could find


    8
    is from the Tenth Edition. Its first appearance in BSD
    seems to be from 1990 in the 4.3 Reno release


    9
    . Two years later, it was added to Issue 4 of The Open Group's CAE Specification. From what I can tell, it did not seem to be in AT&T's System III—presumably the
    printf
    utility did make it into System V at some point but I found it difficult to track this down.



    While
    echo
    is still suitable for use where you know for certain that you want a newline character printed at the end and none of the arguments will start with a hyphen, consider using the
    printf
    utility instead for displaying text. It offers more flexibility and features than you are guaranteed to get with
    echo
    , although it does require a bit of forethought in constructing a proper format string and arguments. That is not necessarily a bad thing, because a script's author
    should
    be thinking about what might happen if it is called with "strange" text or filenames.



    This episode also provides a good case for being careful when naming files—many filesystems will allow you to use hyphens, control characters, quotation marks, and potentially any character other than a slash or a null byte in a filename. As we've seen, some of these characters can create problems for standard utilities. While it can feel limiting, especially for people not using English, the safest filenames to use on a UNIX-like system consist only of characters in the
    "portable filename character set" as defined by POSIX


    10
    and where the first character is
    not
    a hyphen. This set includes the lowercase and uppercase letters "a" through "z", the numerals "0" through "9", and the period, underscore, and hyphen. Notably, it does
    not
    include the space character.



    That leads me to another UNIX Curio that I only just now discovered while researching this episode. This is
    the




    pathchk




    utility


    11
    . It can be run with one or more strings as arguments, checks each one against a set of rules for pathnames, and outputs an error message for each problem found. By default, it checks against the following limits on the system where it's being run: maximum number of bytes in the full path, maximum number of bytes in any component of the path, all byte sequences must be valid in the given directory, and the user running the program must have access to all directories referenced. If run with the
    -p
    option, instead of those limits, it checks against POSIX limits: a maximum of 256 bytes in the full path, a maximum of 14 bytes in each component of the path, and each component must only include characters from the portable set. The
    -P
    option adds warnings if any component starts with a "-" or if the pathname is completely empty. While the exit status will tell you if the checks succeeded or not, I don't feel like the
    pathchk
    utility is well suited to be used in an automated fashion, as the exact wording of its output is not specified and checks cannot be selected individually. However, it can be used interactively to validate pathnames you aren't sure about. See the linked specification for full details.



    References:







    A Research UNIX Reader: Combined Tables of Contents
    https://archive.org/details/a_research_unix_reader/page/n99/mode/1up





    A Research UNIX Reader: Second Edition UNIX echo manual page
    (although this page has "v1" typed at the top, the date and the tables of contents indicate it first appeared in v2, a.k.a. Second Edition) https://archive.org/details/a_research_unix_reader/page/n22/mode/1up





    Seventh Edition UNIX echo manual page
    https://man.cat-v.org/unix_7th/1/echo





    Eighth Edition UNIX echo manual page
    https://man.cat-v.org/unix_8th/1/echo





    Printf specification
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html





    File Format Notation specification
    https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap05.html





    A Research UNIX Reader: Ninth Edition Table of Contents
    https://archive.org/details/a_research_unix_reader/page/n95/mode/1up





    Tenth Edition UNIX echo/printf manual page
    https://man.cat-v.org/unix_10th/1/echo





    4.3BSD Reno printf manual page
    https://man.freebsd.org/cgi/man.cgi?query=printf&sektion=1&manpath=4.3BSD+Reno





    Definitions: Portable Filename Character Set
    https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_282





    Pathchk specification
    https://pubs.opengroup.org/onlinepubs/9699919799/utilities/pathchk.html







    Provide feedback on this episode.
  • Hacker Public Radio

    HPR4666: How I got into tech

    22/06/2026
    This show has been flagged as Clean by the host.

    I started out with Basic on the TI-99/4A in 1984. The bare machine could not be programmed by the user in machine code. In 1985 I bought a ZX Spectrum, that gave me total control over the machine.

    I wrote two FORTH systems on the ZX-Spectrum.

    In 1988 I got my first 8088 PC, also programming it in FORTH.

    In 1992 I got an 80386 PC and I ran Linux on it. MCC Interim Release from v. This was the first Linux distro.

    I have been using Linux ever since.

    From then on I obtained newer PCs, such as a Pentium in 1995, a Pentium-2 in 1998, a Pentium-4 in 2003 and a Core-2 Duo in 2006.

    I used several Linux distributions: but I always return to Debian.

    Links:

    https://github.com/ForthHub/F83 F83.COM is the ready to run FORTH system.

    https://github.com/uho/F-PC F-PC - a Forth system optimized for IBM-PC, XT and AT machines running DOS

    https://www.latte.org/latte.htmlLatte The Language for Transforming Text

    https://en.wikipedia.org/wiki/Joe's_Own_Editor

    https://www.freebsd.org/

    https://www.debian.org/

    https://www.gentoo.org/

    https://en.wikipedia.org/wiki/Mac_Mini

    https://en.wikipedia.org/wiki/PowerPC

    https://en.wikipedia.org/wiki/Ivy_Bridge_(microarchitecture)

    https://en.wikipedia.org/wiki/Ubuntu

    https://en.wikipedia.org/wiki/Firefox

    https://en.wikipedia.org/wiki/Chromium_(web_browser)

    https://www.raspberrypi.com/products/raspberry-pi-400/

    https://www.intel.com/content/www/us/en/ark/products/series/217838/12th-generation-intel-core-i5-processors.html

    https://en.wikipedia.org/wiki/Windows_11

    Provide feedback on this episode.
  • Hacker Public Radio

    HPR4665: Pokémon GO

    19/06/2026
    This show has been flagged as Clean by the host.



    Pokémon Go (stylized as Pokémon GO) is a 2016 augmented reality (AR) mobile game developed and published by Niantic, in partnership with Nintendo and The Pokémon Company, for iOS and Android devices. The game uses GPS to locate, capture, train, and battle Pokémon. It is free-to-play, featuring a freemium model that includes local advertising and offers in-app purchases for additional in-game items. Pokémon Go launched with approximately 150 Pokémon species, with new species regularly introduced.








    -- Wikipedia.org

    Provide feedback on this episode.
  • Hacker Public Radio

    HPR4664: No Input Mixing Tutorial and How to Build a Drone Box

    18/06/2026
    This show has been flagged as Explicit by the host.

    Some links to other tutorials (in case you need a visual element, these helped me out)

    Mixing board tutorial

    https://youtu.be/H-7kQmpjBds

    Drone Box tutorial

    https://youtu.be/50C6DBsqy24

    Provide feedback on this episode.
More Education podcasts
About Hacker Public Radio
Hacker Public Radio is an podcast that releases shows every weekday Monday through Friday. Our shows are produced by the community (you) and can be on any topic that are of interest to hackers and hobbyists.
Podcast website

Listen to Hacker Public Radio, IMO with Michelle Obama and Craig Robinson and many other podcasts from around the world with the radio.net app

Get the free radio.net app

  • Stations and podcasts to bookmark
  • Stream via Wi-Fi or Bluetooth
  • Supports Carplay & Android Auto
  • Many other app features