Windows PowerShell Where-Object equivalent in Linux
Keeps only lines or fields that satisfy a textual or numeric condition.
PowerShell Where-Object
awk CONDITION
awk CONDITION
awk CONDITION
Overview
What this command does
On Windows, "PowerShell Where-Object" is used to filter records. On Linux, the closest practical mapping shown here is "awk CONDITION". Keeps only lines or fields that satisfy a textual or numeric condition. This reference is grouped under PowerShell Equivalents → Text Processing.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows PowerShell Where-Object maps to awk CONDITION 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 PowerShell vs Bash.
Practical tasks
Common use cases
Filter records
Keeps only lines or fields that satisfy a textual or numeric condition.
ps aux | grep firefox
Filter by text
awk -F, "$3 > 1000" data.csv
Filter by a numeric CSV field
df -P | awk "NR>1 && $5+0 > 80"
Find filesystems over 80 percent
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
ps aux | grep firefox
awk -F, '$3 > 1000' data.csv
df -P | awk 'NR>1 && $5+0 > 80'
Walkthrough
Examples with explanations
ps aux | grep firefox # filter lines containing text
awk -F, '$3 > 1000' data.csv # filter rows by a numeric field
df -P | awk 'NR>1 && $5+0 > 80' # filter filesystem usage
Reference
Common options and variations
| Command or option | Use |
|---|---|
ps aux | grep firefox | Filter by text |
awk -F, "$3 > 1000" data.csv | Filter by a numeric CSV field |
df -P | awk "NR>1 && $5+0 > 80" | Find filesystems over 80 percent |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "awk CONDITION" 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 | awk CONDITION |
Same command on this distribution. |
| Fedora | same command | awk CONDITION |
Same command on this distribution. |
| Arch | same command | awk CONDITION |
Same command on this distribution. |
Keep learning