Windows findstr (character replace — n/a) equivalent in Linux
Replaces, deletes, or squeezes individual characters in text — a character-level find and replace.
findstr (character replace — n/a)
tr
tr
tr
Overview
What this command does
On Windows, "findstr (character replace — n/a)" is used to translate or delete characters. On Linux, the closest practical mapping shown here is "tr". Replaces, deletes, or squeezes individual characters in text — a character-level find and replace. This reference is grouped under Text Processing.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows findstr (character replace — n/a) maps to tr for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
For the broader concept behind this mapping, read Linux command-line basics.
Practical tasks
Common use cases
Translate or delete characters
Replaces, deletes, or squeezes individual characters in text — a character-level find and replace.
tr 'a-z' 'A-Z'
Convert to uppercase
tr 'A-Z' 'a-z'
Convert to lowercase
tr -d '\r'
Remove Windows carriage returns (\r\n → \n)
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
echo 'hello world' | tr 'a-z' 'A-Z'
tr -d '\r' < windows_file.txt > fixed.txt
echo 'Hello, World!' | tr -d '[:punct:]'
Walkthrough
Examples with explanations
# No direct Windows CMD equivalent
# Uppercase:
echo 'hello world' | tr 'a-z' 'A-Z'
HELLO WORLD
# Fix Windows line endings:
tr -d '\r' < windows_file.txt > fixed.txt
# Remove all punctuation:
echo 'Hello, World!' | tr -d '[:punct:]'
Reference
Common options and variations
| Command or option | Use |
|---|---|
tr 'a-z' 'A-Z' | Convert to uppercase |
tr 'A-Z' 'a-z' | Convert to lowercase |
tr -d '\r' | Remove Windows carriage returns (\r\n → \n) |
tr -s ' ' | Squeeze multiple spaces into one |
tr -d '[:digit:]' | Delete all digits |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "tr" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | tr |
Same command on this distribution. |
| Fedora | same command | tr |
Same command on this distribution. |
| Arch | same command | tr |
Same command on this distribution. |
Keep learning