The first section of the Pali Canon's first book is called the Sīlakkhandhavagga, which means something like "Chapter on the Entirety of Ethical Practice." Accordingly, the topic of ethics is a central concern to the scriptures in this collection. In fact, there is a long passage about ethical practices which appears (in whole or in part) in all 13 suttas of the Sīlakkhandhavagga.
This passage is used when the Buddha is discussing ethical practices and Buddhist knowledge with various non-Buddhists, such as kings and Brahmin priests. This is usually done to demonstrate the superiority of the Buddha's teaching when compared to rival traditions from his time.
Part of this passage first appears in DN 1, and the rest of it appears in DN 2. The other 11 suttas combine these two parts. For ease of reference, I am putting the summary of this long passage on one page, so that I can avoid reproducing it in the synopsis of all of these suttas.
Ultimately, this passage demonstrates the "threefold training" (tisikkhā) taught by the Buddha: 1. ethical training (sīla) 2. concentration/meditative training (samādhi) 3. wisdom/insight training (paññā).
Students are meant to progress through these stages of training gradually, beginning with the ethical training, progressing to the attainment of meditative states of absorption, and culminating in the direct insights which lead to enlightenment.
The Buddha first discusses how, eventually, a Tathāgata arises in this world and becomes fully-enlightened. That fully-enlightened Buddha goes on to teach the truths he discovers - called the Dhamma - to gods and men alike.
Eventually, someone hears the Buddha's teachings, and is filled with faith. He decides to leave his lay life behind and becomes a disciple. He abandons his home, leaves his family, shaves, and puts on the robes of a monk. This hypothetical person serves as the subject for the rest of this passage.
This section of the passage comes from DN 1. In that sutta, the Buddha was describing moral qualities for which people often praised him, but ultimately, were not very important. In the other suttas, it is used to describe practices observed by our hypothetical monk. It contains 3 broad categories of ethical practices.Lesser Ethics
These 10 points roughly correspond to the 10 precepts observed by novice monks before fully ordaining. The first three are simple: no killing, no taking what isn’t given, and total celibacy. The fourth is refraining from improper speech, including: lies, malicious and divisive words, harsh speech, and useless chatter. The fifth point listed here is interesting; instead of the usual “no intoxicants,” it lists abstaining from damaging seeds or crops. Points six through ten resume the standard the formula: no eating more than once per day (never at night), no attending entertainment shows (such as dances, concerts, and performances); no wearing adornments or perfumes; no sleeping in a luxurious bed; and no accepting gold/silver. This tenth point is expanded to include many other things which must not be accepted, such as: raw grains and flesh; women, girls, or slaves; livestock; and land. It also mentions refraining from running errands for nobles or powerful men; abstaining from cheating, bribery, or deception; abstaining from wounding, killing, capturing, or robbing people; and finally, not taking food by force.Middle Ethics
Here, these points are presented as examples which distinguished the Buddha and his disciples from other religious figures of his time, who failed to meet even these relatively low standards. Several of them are repeated from the previous section.
The point about destroying seeds is repeated. Food, drink, clothes, and other belongings are not stored. The point about not attending entertainment shows is repeated, though this time the list is expanded to include more examples, including “shows from the city of Sobha” (the city of celestial beings called gandhabbas, often described as heavenly musicians).
There is no partaking in the games which ascetics and Brahmins play. Several specific games and toys are listed, which must have been popular in India during the Buddha's time. They are called “idle pursuits.”
Once again, we see the point about refraining from the use of luxurious beds, perfumes and adornments, and idle chatter—which is here he called “animal talk,” with “animal” being a derogatory way to refer lowly, unfavorable things.
He does not enjoy arguments and bicker about doctrines. The point about not running errands is repeated. Finally, he does not deceive, he does not speak indirectly or with hidden messages, he does not belittle others, and he does not concern himself with making further gains.Greater Ethics
This list is exhaustive and likely means little to someone unfamiliar with ancient Indian superstition—much of it goes over my head, certainly—but the main idea here is that it is forbidden to make a living through peddling services to people. Many types of divination, such as palm-reading, foretelling someone’s lifespan, and astrology, are listed. It also forbids curses, charms, and various other things which we would now call “witchcraft.”
Alongside this list of occult services, a few mundane activities are sprinkled in, such as various medical practices, philosophizing, and composing poetry. These things may seem out of place, but it is important to remind ourselves of the context here—the Buddha is simply saying it is inappropriate for a religious person to make a living by offering these services, since ultimately they are “animal arts” and have nothing to do with enlightenment.
The Buddha closes his discussion of ethics by saying that, once a monk has become "accomplished in ethics," he is no longer threatened by danger coming from any direction - like a king who has vanquished all of his enemies, he may stand sure knowing that he is safe from the threats of immorality. He enjoys an internal sense of "blameless joy."
"Guarding the sense-gates" means practicing restraint during the sensory process. When one of the sense-gates becomes engaged by a sense-object, and sense-consciousness arises, someone who is practicing restraint is able to process the experience without becoming fascinated with the "signs" of that sense-object. Someone who is unrestrained during this process, however, may become infatuated with the qualities of whatever thing has engaged their senses, and in this way they may become overwhelmed by desire for (or aversion toward) that sense-object. Guarding the sense-gates allows our hypothetical monk to experience "unsullied happiness" inside himself.
A monk always acts mindfully and with alertness, no matter what it is they're doing. They don't allow themselves to get lost in daydreams and they don't let their mind wander. They control their minds when doing anything and everything.
A monk is content with the bare essentials: his robes, and alms donated to him as food. He is as free a bird, unburdened by unncessary possessions.
Having become established in ethics, guarding his sense-gates, mindful and alert during all activities, and having contentment, our hypothetical monk is now ready to go to some secluded place and practice meditation. Legs crossed, body straight, he is able to abandon the 5 Hindrances - states of mind which act as obstacles to enlightenment and inhibit wisdom (SN 46.37).
He abandons desire by giving up longing for worldly things. He abandons ill-will by meditating with compassion for all living beings. He abandons sloth-and-torpor by being mindful and alert, "meditating on the perception of light" - visualizing the brightness of daylight (see AN 4.41 & 7.58). He abandons restlessness-and-worry by calming the mind. Finally, he abandons doubt by being certain about what sorts of things are skillful.
When he realizes he has become freed from the 5 Hindrances, “joy” (pāmojjam) rises up. This joy leads to a mental state called “rapture” (pīti), which is a sort of energizing pleasure that enlivens and empowers the mind. This, in turn, causes the body to experience tranquillity, leading to a pleasurable physical sensation of “bliss” (sukha). This bliss allows the mind to become immersed in the beginning stage of samādhi, transitioning into the first jhāna.1
Having achieved this profound concentration, our monk is now ready to enter the first jhāna, a state of meditative absorption.
In the 1st jhāna, one now experiences rapture and bliss which arise through the absence of sense-desires as well as the absence of any unskillful mental states. In this stage, he is still using his discursive, thinking mental faculties to gently guide the mind and contemplate the experience of the first jhāna. Although this should be understood as a type of thinking, it is important to understand that this is much more refined than the mind’s usual process of thought—there is no mental chatter, no train of internal dialogue. Having been freed from the unskillful mental states that cloud our usual thoughts, the mind is now functioning in a much more subtle, productive way.
Eventually, he is able to bring even this subtle process of thinking to a stop. This leads to entry into the 2nd jhāna. Rapture and bliss now arise from a more refined state of samādhi. The mind becomes "one-pointed," completely focused, and a powerful state of confidence and mental clarity arises.
In the third jhāna, the previous feeling of "rapture" fades away, leaving a monk with "bliss free from rapture" which fills and permeates his entire body. While meditating, he experiences equanimity and mindful awareness.
In the fourth jhāna, a monk goes beyond all feelings, even the previous jhānic feeling of bliss which had permeated his body. He has "given up all pleasure and pain," and his mind experiences the purity of equanimity and mindfulness. The Buddha explained this as a "pure, bright awareness" which fills the entire body.
After having progressed through these four jhānas, a monk's mind is "immersed in samādhi," a state of sublime concentration. In this state, his mind is purified in such a way which enables him to direct it toward "knowledge and vision." In doing so, he attains direct insight into the teachings of the Buddha.
Specifically, this refers to insight into the nature of the body and consciousness; a monk discerns that his body is a physical thing, made up of the four great elements, born from sexual union, sustained on food, impermanent, and will eventually be destroyed. He also discerns that his consciousness is "supported by and bound to" his body. It should be noted that this is not a mere intellectual understanding - it is a direct experience of this reality.
A monk immersed in samādhi may also direct the mind to the creation of a "manomaya-kaya," or a "mind-made body." In Buddhism, the belief is that a highly-advanced meditator is able to literally produce another body - complete with limbs and faculties - through the power of their purified mind. This is described like pulling a sword from its scabbard; the sword comes from its sheath, but they can both exist separately and be used apart from one another. This mind-made body can be used to visit other realms of existence, or simply to be in two places at once here in the mundane world.2
Immersed in samādhi, a monk may also direct his mind to a number of different supernatural feats. He can multiply himself, pass through solid barriers, descend into the earth and return to the surface (as if it were water), walk on water (as if it were earth), fly through the air while sitting cross-legged, "touch and stroke the sun and the moon,"3 and travel as far as the Brahmā realm.
In addition to the above abilities, a monk immersed in samādhi may become capable of clairaudience (supernatural hearing). This allows him to hear sounds both near and far, in both the human and divine worlds.
Another supernatural feat gained in samādhi is the ability to read minds. The Buddha describes this less like the usual understanding of mind-reading, where you hear someone's internal monologue, and more like a sort of empathy which allows you to understand someone's mental state - detecting whether or not someone's mind has greed, hatred, delusion, or various qualities associated with spiritual attainment.
A monk immersed in samādhi may recollect their past lives. This recollection may span innumerable eons back, and include a great level of detail: names, clans/families, the pleasures and pains experienced, and the ways they died. The Buddha said this is another fruit of renunciation.
When his mind is immersed in samādhi, a monk may use the "divine eye" (dibbacakkhu) to discern how other beings die and are reborn according to their kamma (more commonly known by the Sanskrit word, karma). He can see these beings rising and falling from the various realms of rebirth, and he understands the way the fruits of their volitions cause these states of existence.
Finally, while immersed in samādhi, a monk may apply his mind to the knowledge of destroying the corruptions (āsavās - tainted mental states which lead us to rebirth). In the suttas, the corruptions are usually three in number: 1- The weakness for sensual pleasure (kāmāsava). 2- The weakness for continued existence (bhavāsava). 3- The weakness for ignorance (avijjāsava).
Someone whose mind is still under the power of the corruptions is made vulnerable to the allure of sensual pleasure, continued existence, and ignorance. The corruptions subtly work beneath the surface and influence the way a person behaves. Destroying them is equivalent to enlightenment and the attainment of nibbana. A monk is able to achieve this while immersed in samādhi.
He is able to directly comprehend the Four Noble Truths: he gains an experiential understanding of dukkha, its origin, its cessation, and the Eightfold Path which leads to its cessation. Likewise, he gains an experiential understanding of the corruptions, their origin, their cessation, and the practice which results in their destruction. Having done so, he has become enlightened - his journey has come to an end, and he has escaped the cycle of rebirth. Upon death, no continued existence will follow.
 It is important to understand that these feelings which begin to arise during entry into the jhānas are not like the worldly feelings which lead to craving, clinging, and dukkha. They are described as pleasurable, but they do not stir the underlying tendencies or give rise to unwholesome states of mind. The Buddha called these sensations "spiritual feelings" (niramisa vedana, as opposed to "worldly feelings," samisa vedana). Instead of arising as a result of contact between the internal and external sense spheres, they arise as fruits of religious practice. Various scriptures explain that these spiritual feelings serve a practical function of enabling the mind to abandon unskillful states and the desire for lesser forms of pleasure.
For a detailed look at why spiritual feelings have this empowering effect, look at the works of Keren Arbel, such as this essay and her book "Early Buddhist Meditation: The Four Jhānas as the Actualization of Insight." To see this mentioned in the canon, check MN 14, MN 44, and DN 34 (for starters - there are other such references throughout the suttas).
 It's possible that this idea is shocking to you. Many people who discuss Buddhism try to downplay more fantastic beliefs such as this, particularly those who are interested in portraying Buddhism as some kind of ancient psychotherapy. The simple truth is this: Buddhism is a religion, and it is filled with religious ideas and beliefs. It should not be held to the standards of a science.
 Walshe notes that this line likely refers to some kind of psychic experience, and isn't meant to be taken literally. However, given that the other supernatural feats presumably are meant to be taken literally, a direct reading isn't exactly out-of-place.