How to Use Haiku's Terminal and Shell Environment
A complete walkthrough Haiku's Terminal application and its bash-based shell — familiar to anyone with Unix experience, with a few Haiku-specific tools worth knowing about.
Despite Haiku not being a Unix descendant architecturally, its Terminal application runs a genuine bash shell through its POSIX compatibility layer — meaning most standard Unix shell knowledge transfers directly, alongside a handful of Haiku-specific commands worth knowing.
Step 1: open Terminal
Applications → Terminal
(or Deskbar → Applications → Terminal)
Step 2: use standard POSIX commands as expected
ls -la
cd /boot/home
grep -r "pattern" .
find . -name "*.txt"
Because Haiku’s POSIX layer provides genuine, standard implementations of these tools, they behave the same way they would on Linux or a BSD — no Haiku-specific translation needed for ordinary file and text manipulation.
Step 3: use Haiku-specific commands for attributes
catattr filename # list all attributes on a file
addattr -t string "MyAttr:Name" "value" filename
These commands are Haiku/BeOS-specific, since BFS’s attribute system has no direct Unix equivalent — ls and find don’t know about attributes at all, making these dedicated tools necessary for working with them from the shell.
Step 4: query BFS indexes and run queries from the command line
query 'BEOS:TYPE=="text/plain"'
The query command runs a BFS query directly from Terminal — the command-line equivalent of Tracker’s graphical Find window, useful for scripting searches based on indexed attributes rather than just filenames.
Step 5: manage packages from the command line
pkgman search <name>
pkgman install <name>
Covered in more depth in installing software with HaikuDepot and pkgman — the same package management system, accessible without the graphical HaikuDepot interface.
Step 6: customize your shell environment
# ~/.profile or ~/.bashrc, same conventions as elsewhere
export EDITOR=nano
alias ll='ls -la'
Standard bash configuration file conventions apply here exactly as they would on Linux — Haiku’s bash is a genuine, largely unmodified bash, not a reimplementation with different configuration conventions.
Step 7: check running processes Haiku-natively, alongside standard ps
ps aux # standard POSIX process listing
listusb # Haiku-specific: list USB devices
listdev # Haiku-specific: list detected devices
Step 8: run a script combining POSIX tools and Haiku-specific commands
#!/bin/sh
for f in *.jpg; do
addattr -t string "Photo:Processed" "yes" "$f"
done
Nothing prevents mixing standard POSIX shell scripting with Haiku-specific attribute commands in the same script — a practical illustration of how the POSIX layer and Haiku’s native capabilities coexist rather than being mutually exclusive.
Why the POSIX-familiar parts and the Haiku-specific parts coexist so cleanly
Haiku’s POSIX compatibility layer genuinely implements standard Unix conventions faithfully, rather than approximating them loosely — which is exactly why ls, grep, and find behave predictably while addattr, catattr, and query extend that same shell environment with capabilities BFS provides that no standard POSIX tool has any concept of. Understanding this split — what’s genuinely portable Unix knowledge versus what’s Haiku-specific — is the fastest way to get comfortable in Haiku’s Terminal without needing to relearn shell basics from scratch.