Linux seq Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux seq Guide
Complete beginner-friendly guide to seq on Linux, covering Arch Linux, CachyOS, and other distributions including number sequences, range generation, and loop counters.
Table of Contents
seq Basics
Generate Sequence
Basic usage:
# Generate sequence
seq 5
# Output:
# 1
# 2
# 3
# 4
# 5
Range
Start and end:
# Range
seq 1 5
# Output: 1 to 5
Number Sequences
Custom Range
Specify range:
# Custom range
seq 10 15
# Output: 10 to 15
Reverse Order
Countdown:
# Reverse
seq 5 1
# Output: 5 to 1 (backwards)
Step Size
Increment
Step size:
# Step size
seq 1 2 10
# Format: start step end
# Output: 1, 3, 5, 7, 9
Decimal Steps
Decimal increments:
# Decimal steps
seq 0 0.5 2
# Output: 0, 0.5, 1.0, 1.5, 2.0
Formatting
Separator
Custom separator:
# Custom separator
seq -s ", " 1 5
# -s = separator
# Output: 1, 2, 3, 4, 5
Format String
Format output:
# Format string
seq -f "file%02g.txt" 1 5
# -f = format
# Output: file01.txt, file02.txt, etc.
Troubleshooting
seq Not Found
Check installation:
# seq is part of coreutils
# Usually pre-installed
# Check seq
which seq
Summary
This guide covered seq usage, number sequences, and range generation for Arch Linux, CachyOS, and other distributions.
Next Steps
- Bash Scripting Guide - Scripting basics
- for Loops - Loop constructs
- seq Documentation:
man seq
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.