# for Loop

*noun*

say it: **“FOR LOOP”** **/ˈfɔr ˈlup/**

A loop that repeats the same commands once for each item in a list, such as every file in a folder.

## What is a **for loop** in bash?

A **for loop** runs the same commands once for every item in a list, with a variable holding the item each time. The list can be words you type, numbers from braces such as `{1..10}`, or files from a wildcard, which makes renaming hundreds of files one short loop.

```bash
for f in telemetry/*.tmp; do
  mv "$f" "${f%.tmp}.log"
done
```

## In a sentence

- “One **for loop** renamed all thirty telemetry files.”
- “The **for loop** counted down from 10 to 1 before printing Liftoff.”

Level: Apprentice · [More Unix terms at this level](https://www.ask-codey.com/glossary?category=unix&level=2)

Updated: November 10, 2026

## In other subjects

- [for Loop in C#](https://www.ask-codey.com/glossary/for-loop-c-sharp)
- [for Loop in Java](https://www.ask-codey.com/glossary/for-loop-java)
- [for Loop in JavaScript](https://www.ask-codey.com/glossary/for-loop-javascript)
- [for Loop in PowerShell](https://www.ask-codey.com/glossary/for-loop-powershell)
- [for Loop in Python](https://www.ask-codey.com/glossary/for-loop)

Source: https://www.ask-codey.com/glossary/for-loop-unix
