Object Types
Every ps-bash command returns a typed PSCustomObject. Each object carries a .BashText property for terminal display and typed properties for programmatic access. This page documents all 20 object types.
Quick Reference
Section titled “Quick Reference”| Command(s) | Type | Key Properties |
|---|---|---|
echo, printf, pwd, hostname, whoami, basename, dirname | PsBash.TextOutput | BashText |
ls | PsBash.LsEntry | Name, FullPath, SizeBytes, Permissions, IsDirectory |
cat | PsBash.CatLine | LineNumber, Content, FileName |
grep (file mode) | PsBash.GrepMatch | FileName, LineNumber, Line |
wc | PsBash.WcResult | Lines, Words, Bytes, FileName |
find | PsBash.FindEntry | Path, Name, FullPath, SizeBytes, IsDirectory |
stat | PsBash.StatEntry | Name, SizeBytes, Permissions, OctalPerms, Inode |
ps | PsBash.PsEntry | PID, User, CPU, Memory, Command |
date | PsBash.DateOutput | Year, Month, Day, Epoch, DateTime |
seq | PsBash.SeqOutput | Value, Index |
expr | PsBash.ExprOutput | Value |
du | PsBash.DuEntry | Size, SizeBytes, Path, Depth |
tree | PsBash.TreeEntry | Name, Path, Depth, IsDirectory |
env, printenv | PsBash.EnvEntry | Name, Value |
rg | PsBash.RgMatch | FileName, LineNumber, Line |
gzip -l | PsBash.GzipListOutput | CompressedSize, UncompressedSize, Ratio |
tar -t | PsBash.TarListOutput | Name, Size, ModifiedDate |
time | PsBash.TimeOutput | RealTime, Command, ExitCode |
which | PsBash.WhichOutput | Command, Path, Type |
alias | PsBash.AliasOutput | Name, Value |
PsBash.TextOutput
Section titled “PsBash.TextOutput”The base type for commands that produce plain text output. Also used as the foundation for every other type via New-BashObject.
Produced by
Section titled “Produced by”echo, printf, pwd, hostname, whoami, basename, dirname, file, md5sum, sha1sum, sha256sum, base64, and various pipeline utilities in text mode.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
BashText | string | Formatted output text |
Some commands add extra properties to their TextOutput objects:
file command adds FileName (string), FileType (string), and MimeType (string).
md5sum / sha1sum / sha256sum add Hash (string), FileName (string), and Algorithm (string).
BashText format
Section titled “BashText format”Hello, world!\nExample
Section titled “Example”$out = echo 'Hello, world!'$out.BashText # "Hello, world!\n"
$loc = pwd$loc.BashText # "/home/beagle/projects"
$info = file README.md$info.FileType # "ASCII text"$info.MimeType # "text/plain"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee. Bridge commands match against BashText and pass the original object through.
PsBash.LsEntry
Section titled “PsBash.LsEntry”Represents a single file or directory entry from ls.
Produced by
Section titled “Produced by”ls
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Name | string | File or directory name |
FullPath | string | Absolute path on disk |
IsDirectory | bool | $true for directories |
SizeBytes | long | File size in bytes (0 for directories) |
Permissions | string | Unix-style permission string (e.g. -rw-r--r--) |
LinkCount | int | Number of hard links |
Owner | string | File owner name |
Group | string | File group name |
LastModified | DateTime | Last modification timestamp |
BashText | string | Formatted ls output line |
BashText format
Section titled “BashText format”-rw-r--r-- 1 beagle beagle 4096 Mar 15 10:30 script.ps1Example
Section titled “Example”$files = ls -la$files[0].Name # "script.ps1"$files[0].SizeBytes # 4096$files[0].IsDirectory # False$files[0].Permissions # "-rw-r--r--"$files[0].LastModified # 03/15/2026 10:30:00Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee. Filter by name and still access typed properties:
$ps1 = ls -la | grep '.ps1'$ps1[0].SizeBytes # still an integerPsBash.CatLine
Section titled “PsBash.CatLine”Represents a single line of file content from cat.
Produced by
Section titled “Produced by”cat, head (file mode), tail (file mode)
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
LineNumber | int | 1-based line number in the file |
Content | string | Raw line content without formatting |
FileName | string | Source file name (empty for stdin) |
BashText | string | Formatted output (may include line numbers if -n flag used) |
BashText format
Section titled “BashText format” 1 first line of the fileExample
Section titled “Example”$lines = cat -n myfile.txt$lines[0].LineNumber # 1$lines[0].Content # "first line of the file"$lines[0].FileName # "myfile.txt"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.GrepMatch
Section titled “PsBash.GrepMatch”Represents a single match from grep when searching files directly. In pipeline mode, grep passes through the original input type instead.
Produced by
Section titled “Produced by”grep (file mode only)
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
FileName | string | Path of the file containing the match |
LineNumber | int | 1-based line number of the match |
Line | string | Full text of the matching line |
BashText | string | Formatted match output |
BashText format
Section titled “BashText format”src/main.ps1:42:function Get-Data {Example
Section titled “Example”$matches = grep -rn 'function' src/$matches[0].FileName # "src/main.ps1"$matches[0].LineNumber # 42$matches[0].Line # "function Get-Data {"Pipeline bridge
Section titled “Pipeline bridge”In pipeline mode, grep does not produce GrepMatch objects. It filters the incoming objects by matching against their BashText and passes the original typed objects through unchanged.
# File mode: produces GrepMatchgrep 'pattern' file.txt
# Pipeline mode: passes through LsEntry objectsls -la | grep '.ps1'PsBash.WcResult
Section titled “PsBash.WcResult”Represents word, line, and byte counts from wc.
Produced by
Section titled “Produced by”wc
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Lines | int | Number of lines |
Words | int | Number of words |
Bytes | int | Number of bytes |
FileName | string | Source file name (empty for stdin) |
BashText | string | Formatted count output |
BashText format
Section titled “BashText format” 42 318 2048 myfile.txtExample
Section titled “Example”$count = wc myfile.txt$count.Lines # 42$count.Words # 318$count.Bytes # 2048$count.FileName # "myfile.txt"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.FindEntry
Section titled “PsBash.FindEntry”Represents a single file or directory found by find.
Produced by
Section titled “Produced by”find
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Path | string | Display path (relative to search root) |
Name | string | File or directory name |
FullPath | string | Absolute path on disk |
IsDirectory | bool | $true for directories |
SizeBytes | long | File size in bytes |
Permissions | string | Unix-style permission string |
LinkCount | int | Number of hard links |
Owner | string | File owner name |
Group | string | File group name |
LastModified | DateTime | Last modification timestamp |
BashText | string | Display path (same as Path) |
BashText format
Section titled “BashText format”./src/main.ps1Example
Section titled “Example”$found = find . -name '*.ps1'$found[0].Path # "./src/main.ps1"$found[0].Name # "main.ps1"$found[0].SizeBytes # 4096$found[0].IsDirectory # FalsePipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.StatEntry
Section titled “PsBash.StatEntry”Represents detailed file metadata from stat.
Produced by
Section titled “Produced by”stat
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Name | string | File or directory name |
FullPath | string | Absolute path on disk |
IsDirectory | bool | $true for directories |
SizeBytes | long | File size in bytes |
Permissions | string | Unix-style permission string (e.g. -rw-r--r--) |
OctalPerms | string | Octal permission code (e.g. 0644) |
LinkCount | int | Number of hard links |
Owner | string | File owner name |
Group | string | File group name |
Inode | long | Inode number |
Blocks | long | Number of 512-byte blocks allocated |
Device | string | Device identifier |
LastModified | DateTime | Last modification timestamp |
MtimeEpoch | long | Modification time as Unix epoch seconds |
AccessTime | DateTime | Last access timestamp |
AtimeEpoch | long | Access time as Unix epoch seconds |
BashText | string | Formatted stat output |
BashText format
Section titled “BashText format” File: script.ps1 Size: 4096 Blocks: 8 IO Block: 4096 regular fileDevice: 820h/2080d Inode: 1234567 Links: 1Access: (0644/-rw-r--r--) Uid: ( 1000/ beagle) Gid: ( 1000/ beagle)Access: 2026-03-15 10:30:00.000000000Modify: 2026-03-15 10:30:00.000000000Example
Section titled “Example”$info = stat myfile.txt$info.SizeBytes # 4096$info.OctalPerms # "0644"$info.Inode # 1234567$info.MtimeEpoch # 1773849000$info.Blocks # 8Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.PsEntry
Section titled “PsBash.PsEntry”Represents a single process entry from ps.
Produced by
Section titled “Produced by”ps
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
PID | int | Process ID |
PPID | int | Parent process ID |
User | string | Process owner |
CPU | double | CPU usage percentage |
Memory | double | Memory usage percentage |
MemoryMB | double | Memory usage in megabytes |
VSZ | long | Virtual memory size in KB |
RSS | long | Resident set size in KB |
TTY | string | Controlling terminal |
Stat | string | Process state code |
Start | object | Process start time |
Time | string | Cumulative CPU time |
Command | string | Command name |
CommandLine | string | Full command line |
ProcessName | string | Process name |
WorkingSet | long | Working set size in bytes |
BashText | string | Formatted ps output line |
BashText format
Section titled “BashText format”beagle 1234 0.1 2.3 123456 45678 ? Ss 10:30 0:01 pwshExample
Section titled “Example”$procs = ps aux$procs[0].PID # 1234$procs[0].User # "beagle"$procs[0].CPU # 0.1$procs[0].Memory # 2.3$procs[0].Command # "pwsh"$procs[0].MemoryMB # 44.6Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.DateOutput
Section titled “PsBash.DateOutput”Represents a parsed date/time value from date.
Produced by
Section titled “Produced by”date
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Year | int | Four-digit year |
Month | int | Month number (1-12) |
Day | int | Day of month (1-31) |
Hour | int | Hour (0-23) |
Minute | int | Minute (0-59) |
Second | int | Second (0-59) |
Epoch | long | Unix epoch seconds |
DayOfWeek | string | Full day name (e.g. Wednesday) |
TimeZone | string | Time zone identifier |
DateTime | DateTimeOffset | Full .NET DateTimeOffset value |
BashText | string | Formatted date string |
BashText format
Section titled “BashText format”Wed Mar 15 10:30:00 PDT 2026Example
Section titled “Example”$now = date$now.Year # 2026$now.Epoch # 1773849000$now.DayOfWeek # "Wednesday"$now.DateTime # System.DateTimeOffset value
$epoch = date '+%s'Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.SeqOutput
Section titled “PsBash.SeqOutput”Represents a single value in a numeric sequence from seq.
Produced by
Section titled “Produced by”seq
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Value | long or double | Numeric value (integer when possible, double for fractional sequences) |
Index | int | 0-based position in the sequence |
BashText | string | Formatted number string |
BashText format
Section titled “BashText format”5Example
Section titled “Example”$nums = seq 1 5$nums[0].Value # 1$nums[0].Index # 0$nums[4].Value # 5$nums[4].Index # 4Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.ExprOutput
Section titled “PsBash.ExprOutput”Represents the result of an arithmetic or string expression from expr.
Produced by
Section titled “Produced by”expr
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Value | long or string | Result value (integer for arithmetic, string for string operations) |
BashText | string | Formatted result string |
BashText format
Section titled “BashText format”42Example
Section titled “Example”$result = expr 6 '*' 7$result.Value # 42$result.BashText # "42"
$len = expr length 'hello'$len.Value # 5Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.DuEntry
Section titled “PsBash.DuEntry”Represents a disk usage entry from du.
Produced by
Section titled “Produced by”du
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Size | long | Size in kilobytes |
SizeBytes | long | Size in bytes |
SizeHuman | string | Human-readable size (e.g. 4.0K) |
Path | string | Directory or file path |
Depth | int | Directory depth relative to search root |
IsTotal | bool | $true for the grand total line |
BashText | string | Formatted du output line |
BashText format
Section titled “BashText format”4096 ./srcExample
Section titled “Example”$usage = du -sh src/$usage[0].SizeBytes # 4096$usage[0].SizeHuman # "4.0K"$usage[0].Path # "src"$usage[0].Depth # 0Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.TreeEntry
Section titled “PsBash.TreeEntry”Represents a single node in a directory tree from tree.
Produced by
Section titled “Produced by”tree
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Name | string | File or directory name (empty for summary line) |
Path | string | Relative path from tree root (empty for root and summary) |
Depth | int | Nesting depth (0 for root and summary) |
IsDirectory | bool | $true for directories |
TreePrefix | string | Unicode tree-drawing prefix characters |
BashText | string | Formatted tree line with prefix and name |
BashText format
Section titled “BashText format”src├── main.ps1├── lib/│ └── utils.ps1└── tests/3 directories, 2 filesExample
Section titled “Example”$nodes = tree src/$nodes[0].Name # "src"$nodes[0].IsDirectory # True$nodes[1].Name # "main.ps1"$nodes[1].Depth # 1$nodes[1].TreePrefix # "├── "Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.EnvEntry
Section titled “PsBash.EnvEntry”Represents a single environment variable from env or printenv.
Produced by
Section titled “Produced by”env, printenv
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Name | string | Variable name |
Value | string | Variable value |
BashText | string | Formatted as NAME=value |
BashText format
Section titled “BashText format”PATH=/usr/local/bin:/usr/bin:/binExample
Section titled “Example”$vars = env$path = env PATH$path.Name # "PATH"$path.Value # "/usr/local/bin:/usr/bin:/bin"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.RgMatch
Section titled “PsBash.RgMatch”Represents a single match from rg (ripgrep-style search).
Produced by
Section titled “Produced by”rg
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
FileName | string | Path of the file containing the match |
LineNumber | int | 1-based line number of the match |
Line | string | Full text of the matching line |
BashText | string | Formatted match output |
BashText format
Section titled “BashText format”src/main.ps1:42:function Get-Data {Example
Section titled “Example”$hits = rg -n 'function' src/$hits[0].FileName # "src/main.ps1"$hits[0].LineNumber # 42$hits[0].Line # "function Get-Data {"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.GzipListOutput
Section titled “PsBash.GzipListOutput”Represents compression metadata from gzip -l.
Produced by
Section titled “Produced by”gzip -l
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
CompressedSize | long | Compressed file size in bytes |
UncompressedSize | long | Original file size in bytes |
Ratio | string | Compression ratio (e.g. 72.5%) |
FileName | string | Path to the compressed file |
BashText | string | Formatted listing line |
BashText format
Section titled “BashText format” 1024 4096 75.0% data.gzExample
Section titled “Example”$info = gzip -l archive.gz$info.CompressedSize # 1024$info.UncompressedSize # 4096$info.Ratio # "75.0%"$info.FileName # "archive.gz"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.TarListOutput
Section titled “PsBash.TarListOutput”Represents a single entry listed from a tar archive with tar -t.
Produced by
Section titled “Produced by”tar -t
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Name | string | Entry file name (without directory path) |
Size | long | Uncompressed file size in bytes |
ModifiedDate | DateTime | Last modification timestamp of the entry |
BashText | string | Full entry path in the archive |
BashText format
Section titled “BashText format”src/main.ps1Example
Section titled “Example”$entries = tar -tf archive.tar.gz$entries[0].Name # "main.ps1"$entries[0].Size # 4096$entries[0].ModifiedDate # 03/15/2026 10:30:00$entries[0].BashText # "src/main.ps1"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.TimeOutput
Section titled “PsBash.TimeOutput”Represents the result of timing a command with time.
Produced by
Section titled “Produced by”time
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
RealTime | TimeSpan | Wall-clock elapsed time |
Command | string | The command that was timed |
ExitCode | int | Exit code of the timed command (0 for success) |
BashText | string | Output text from the timed command |
BashText format
Section titled “BashText format”The BashText contains the stdout of the timed command. The timing information is written to stderr:
real 0.042sExample
Section titled “Example”$result = time { ls -la }$result.RealTime # 00:00:00.0420000$result.RealTime.TotalSeconds # 0.042$result.Command # "{ ls -la }"$result.ExitCode # 0Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.WhichOutput
Section titled “PsBash.WhichOutput”Represents a resolved command location from which.
Produced by
Section titled “Produced by”which
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Command | string | Command name that was looked up |
Path | string | Resolved path or definition |
Type | string | Command type (e.g. application, function, alias) |
BashText | string | Resolved path |
BashText format
Section titled “BashText format”/usr/bin/gitExample
Section titled “Example”$loc = which git$loc.Command # "git"$loc.Path # "/usr/bin/git"$loc.Type # "application"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.
PsBash.AliasOutput
Section titled “PsBash.AliasOutput”Represents a shell alias definition from alias.
Produced by
Section titled “Produced by”alias
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
Name | string | Alias name |
Value | string | Alias expansion value |
BashText | string | Formatted alias definition |
BashText format
Section titled “BashText format”alias ll='ls -la'Example
Section titled “Example”alias ll='ls -la'$aliases = alias$aliases[0].Name # "ll"$aliases[0].Value # "ls -la"Pipeline bridge
Section titled “Pipeline bridge”Survives grep, sort, head, tail, and tee.