Skip to content

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.

Command(s)TypeKey Properties
echo, printf, pwd, hostname, whoami, basename, dirnamePsBash.TextOutputBashText
lsPsBash.LsEntryName, FullPath, SizeBytes, Permissions, IsDirectory
catPsBash.CatLineLineNumber, Content, FileName
grep (file mode)PsBash.GrepMatchFileName, LineNumber, Line
wcPsBash.WcResultLines, Words, Bytes, FileName
findPsBash.FindEntryPath, Name, FullPath, SizeBytes, IsDirectory
statPsBash.StatEntryName, SizeBytes, Permissions, OctalPerms, Inode
psPsBash.PsEntryPID, User, CPU, Memory, Command
datePsBash.DateOutputYear, Month, Day, Epoch, DateTime
seqPsBash.SeqOutputValue, Index
exprPsBash.ExprOutputValue
duPsBash.DuEntrySize, SizeBytes, Path, Depth
treePsBash.TreeEntryName, Path, Depth, IsDirectory
env, printenvPsBash.EnvEntryName, Value
rgPsBash.RgMatchFileName, LineNumber, Line
gzip -lPsBash.GzipListOutputCompressedSize, UncompressedSize, Ratio
tar -tPsBash.TarListOutputName, Size, ModifiedDate
timePsBash.TimeOutputRealTime, Command, ExitCode
whichPsBash.WhichOutputCommand, Path, Type
aliasPsBash.AliasOutputName, Value

The base type for commands that produce plain text output. Also used as the foundation for every other type via New-BashObject.

echo, printf, pwd, hostname, whoami, basename, dirname, file, md5sum, sha1sum, sha256sum, base64, and various pipeline utilities in text mode.

PropertyTypeDescription
BashTextstringFormatted 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).

Hello, world!\n
Terminal window
$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"

Survives grep, sort, head, tail, and tee. Bridge commands match against BashText and pass the original object through.


Represents a single file or directory entry from ls.

ls

PropertyTypeDescription
NamestringFile or directory name
FullPathstringAbsolute path on disk
IsDirectorybool$true for directories
SizeByteslongFile size in bytes (0 for directories)
PermissionsstringUnix-style permission string (e.g. -rw-r--r--)
LinkCountintNumber of hard links
OwnerstringFile owner name
GroupstringFile group name
LastModifiedDateTimeLast modification timestamp
BashTextstringFormatted ls output line
-rw-r--r-- 1 beagle beagle 4096 Mar 15 10:30 script.ps1
Terminal window
$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:00

Survives grep, sort, head, tail, and tee. Filter by name and still access typed properties:

Terminal window
$ps1 = ls -la | grep '.ps1'
$ps1[0].SizeBytes # still an integer

Represents a single line of file content from cat.

cat, head (file mode), tail (file mode)

PropertyTypeDescription
LineNumberint1-based line number in the file
ContentstringRaw line content without formatting
FileNamestringSource file name (empty for stdin)
BashTextstringFormatted output (may include line numbers if -n flag used)
1 first line of the file
Terminal window
$lines = cat -n myfile.txt
$lines[0].LineNumber # 1
$lines[0].Content # "first line of the file"
$lines[0].FileName # "myfile.txt"

Survives grep, sort, head, tail, and tee.


Represents a single match from grep when searching files directly. In pipeline mode, grep passes through the original input type instead.

grep (file mode only)

PropertyTypeDescription
FileNamestringPath of the file containing the match
LineNumberint1-based line number of the match
LinestringFull text of the matching line
BashTextstringFormatted match output
src/main.ps1:42:function Get-Data {
Terminal window
$matches = grep -rn 'function' src/
$matches[0].FileName # "src/main.ps1"
$matches[0].LineNumber # 42
$matches[0].Line # "function Get-Data {"

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.

Terminal window
# File mode: produces GrepMatch
grep 'pattern' file.txt
# Pipeline mode: passes through LsEntry objects
ls -la | grep '.ps1'

Represents word, line, and byte counts from wc.

wc

PropertyTypeDescription
LinesintNumber of lines
WordsintNumber of words
BytesintNumber of bytes
FileNamestringSource file name (empty for stdin)
BashTextstringFormatted count output
42 318 2048 myfile.txt
Terminal window
$count = wc myfile.txt
$count.Lines # 42
$count.Words # 318
$count.Bytes # 2048
$count.FileName # "myfile.txt"

Survives grep, sort, head, tail, and tee.


Represents a single file or directory found by find.

find

PropertyTypeDescription
PathstringDisplay path (relative to search root)
NamestringFile or directory name
FullPathstringAbsolute path on disk
IsDirectorybool$true for directories
SizeByteslongFile size in bytes
PermissionsstringUnix-style permission string
LinkCountintNumber of hard links
OwnerstringFile owner name
GroupstringFile group name
LastModifiedDateTimeLast modification timestamp
BashTextstringDisplay path (same as Path)
./src/main.ps1
Terminal window
$found = find . -name '*.ps1'
$found[0].Path # "./src/main.ps1"
$found[0].Name # "main.ps1"
$found[0].SizeBytes # 4096
$found[0].IsDirectory # False

Survives grep, sort, head, tail, and tee.


Represents detailed file metadata from stat.

stat

PropertyTypeDescription
NamestringFile or directory name
FullPathstringAbsolute path on disk
IsDirectorybool$true for directories
SizeByteslongFile size in bytes
PermissionsstringUnix-style permission string (e.g. -rw-r--r--)
OctalPermsstringOctal permission code (e.g. 0644)
LinkCountintNumber of hard links
OwnerstringFile owner name
GroupstringFile group name
InodelongInode number
BlockslongNumber of 512-byte blocks allocated
DevicestringDevice identifier
LastModifiedDateTimeLast modification timestamp
MtimeEpochlongModification time as Unix epoch seconds
AccessTimeDateTimeLast access timestamp
AtimeEpochlongAccess time as Unix epoch seconds
BashTextstringFormatted stat output
File: script.ps1
Size: 4096 Blocks: 8 IO Block: 4096 regular file
Device: 820h/2080d Inode: 1234567 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 1000/ beagle) Gid: ( 1000/ beagle)
Access: 2026-03-15 10:30:00.000000000
Modify: 2026-03-15 10:30:00.000000000
Terminal window
$info = stat myfile.txt
$info.SizeBytes # 4096
$info.OctalPerms # "0644"
$info.Inode # 1234567
$info.MtimeEpoch # 1773849000
$info.Blocks # 8

Survives grep, sort, head, tail, and tee.


Represents a single process entry from ps.

ps

PropertyTypeDescription
PIDintProcess ID
PPIDintParent process ID
UserstringProcess owner
CPUdoubleCPU usage percentage
MemorydoubleMemory usage percentage
MemoryMBdoubleMemory usage in megabytes
VSZlongVirtual memory size in KB
RSSlongResident set size in KB
TTYstringControlling terminal
StatstringProcess state code
StartobjectProcess start time
TimestringCumulative CPU time
CommandstringCommand name
CommandLinestringFull command line
ProcessNamestringProcess name
WorkingSetlongWorking set size in bytes
BashTextstringFormatted ps output line
beagle 1234 0.1 2.3 123456 45678 ? Ss 10:30 0:01 pwsh
Terminal window
$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.6

Survives grep, sort, head, tail, and tee.


Represents a parsed date/time value from date.

date

PropertyTypeDescription
YearintFour-digit year
MonthintMonth number (1-12)
DayintDay of month (1-31)
HourintHour (0-23)
MinuteintMinute (0-59)
SecondintSecond (0-59)
EpochlongUnix epoch seconds
DayOfWeekstringFull day name (e.g. Wednesday)
TimeZonestringTime zone identifier
DateTimeDateTimeOffsetFull .NET DateTimeOffset value
BashTextstringFormatted date string
Wed Mar 15 10:30:00 PDT 2026
Terminal window
$now = date
$now.Year # 2026
$now.Epoch # 1773849000
$now.DayOfWeek # "Wednesday"
$now.DateTime # System.DateTimeOffset value
$epoch = date '+%s'

Survives grep, sort, head, tail, and tee.


Represents a single value in a numeric sequence from seq.

seq

PropertyTypeDescription
Valuelong or doubleNumeric value (integer when possible, double for fractional sequences)
Indexint0-based position in the sequence
BashTextstringFormatted number string
5
Terminal window
$nums = seq 1 5
$nums[0].Value # 1
$nums[0].Index # 0
$nums[4].Value # 5
$nums[4].Index # 4

Survives grep, sort, head, tail, and tee.


Represents the result of an arithmetic or string expression from expr.

expr

PropertyTypeDescription
Valuelong or stringResult value (integer for arithmetic, string for string operations)
BashTextstringFormatted result string
42
Terminal window
$result = expr 6 '*' 7
$result.Value # 42
$result.BashText # "42"
$len = expr length 'hello'
$len.Value # 5

Survives grep, sort, head, tail, and tee.


Represents a disk usage entry from du.

du

PropertyTypeDescription
SizelongSize in kilobytes
SizeByteslongSize in bytes
SizeHumanstringHuman-readable size (e.g. 4.0K)
PathstringDirectory or file path
DepthintDirectory depth relative to search root
IsTotalbool$true for the grand total line
BashTextstringFormatted du output line
4096 ./src
Terminal window
$usage = du -sh src/
$usage[0].SizeBytes # 4096
$usage[0].SizeHuman # "4.0K"
$usage[0].Path # "src"
$usage[0].Depth # 0

Survives grep, sort, head, tail, and tee.


Represents a single node in a directory tree from tree.

tree

PropertyTypeDescription
NamestringFile or directory name (empty for summary line)
PathstringRelative path from tree root (empty for root and summary)
DepthintNesting depth (0 for root and summary)
IsDirectorybool$true for directories
TreePrefixstringUnicode tree-drawing prefix characters
BashTextstringFormatted tree line with prefix and name
src
├── main.ps1
├── lib/
│ └── utils.ps1
└── tests/
3 directories, 2 files
Terminal window
$nodes = tree src/
$nodes[0].Name # "src"
$nodes[0].IsDirectory # True
$nodes[1].Name # "main.ps1"
$nodes[1].Depth # 1
$nodes[1].TreePrefix # "├── "

Survives grep, sort, head, tail, and tee.


Represents a single environment variable from env or printenv.

env, printenv

PropertyTypeDescription
NamestringVariable name
ValuestringVariable value
BashTextstringFormatted as NAME=value
PATH=/usr/local/bin:/usr/bin:/bin
Terminal window
$vars = env
$path = env PATH
$path.Name # "PATH"
$path.Value # "/usr/local/bin:/usr/bin:/bin"

Survives grep, sort, head, tail, and tee.


Represents a single match from rg (ripgrep-style search).

rg

PropertyTypeDescription
FileNamestringPath of the file containing the match
LineNumberint1-based line number of the match
LinestringFull text of the matching line
BashTextstringFormatted match output
src/main.ps1:42:function Get-Data {
Terminal window
$hits = rg -n 'function' src/
$hits[0].FileName # "src/main.ps1"
$hits[0].LineNumber # 42
$hits[0].Line # "function Get-Data {"

Survives grep, sort, head, tail, and tee.


Represents compression metadata from gzip -l.

gzip -l

PropertyTypeDescription
CompressedSizelongCompressed file size in bytes
UncompressedSizelongOriginal file size in bytes
RatiostringCompression ratio (e.g. 72.5%)
FileNamestringPath to the compressed file
BashTextstringFormatted listing line
1024 4096 75.0% data.gz
Terminal window
$info = gzip -l archive.gz
$info.CompressedSize # 1024
$info.UncompressedSize # 4096
$info.Ratio # "75.0%"
$info.FileName # "archive.gz"

Survives grep, sort, head, tail, and tee.


Represents a single entry listed from a tar archive with tar -t.

tar -t

PropertyTypeDescription
NamestringEntry file name (without directory path)
SizelongUncompressed file size in bytes
ModifiedDateDateTimeLast modification timestamp of the entry
BashTextstringFull entry path in the archive
src/main.ps1
Terminal window
$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"

Survives grep, sort, head, tail, and tee.


Represents the result of timing a command with time.

time

PropertyTypeDescription
RealTimeTimeSpanWall-clock elapsed time
CommandstringThe command that was timed
ExitCodeintExit code of the timed command (0 for success)
BashTextstringOutput text from the timed command

The BashText contains the stdout of the timed command. The timing information is written to stderr:

real 0.042s
Terminal window
$result = time { ls -la }
$result.RealTime # 00:00:00.0420000
$result.RealTime.TotalSeconds # 0.042
$result.Command # "{ ls -la }"
$result.ExitCode # 0

Survives grep, sort, head, tail, and tee.


Represents a resolved command location from which.

which

PropertyTypeDescription
CommandstringCommand name that was looked up
PathstringResolved path or definition
TypestringCommand type (e.g. application, function, alias)
BashTextstringResolved path
/usr/bin/git
Terminal window
$loc = which git
$loc.Command # "git"
$loc.Path # "/usr/bin/git"
$loc.Type # "application"

Survives grep, sort, head, tail, and tee.


Represents a shell alias definition from alias.

alias

PropertyTypeDescription
NamestringAlias name
ValuestringAlias expansion value
BashTextstringFormatted alias definition
alias ll='ls -la'
Terminal window
alias ll='ls -la'
$aliases = alias
$aliases[0].Name # "ll"
$aliases[0].Value # "ls -la"

Survives grep, sort, head, tail, and tee.