๐งพ Summary
This document provides a comprehensive overview of FreeBSD's shell basics, covering essential concepts and practices for effective shell scripting and command-line usage on FreeBSD systems.
๐ฏ Key Concepts
FreeBSD uses a traditional BSD userland with some key differences from GNU/Linux systems:
- Shell: Default shell is typically sh (POSIX-compliant) or tcsh for root
- Userland: BSD-derived tools rather than GNU equivalents
- Package Management: Uses pkg for binary packages and ports for source compilation
๐ง Core Components
Shell Environment
FreeBSD systems commonly use:
- sh - POSIX-compliant shell (default for scripts)
- tcsh - Default root shell in many installations
- bash - Available via packages (pkg install bash)
- zsh - Available via packages (pkg install zsh)
Filesystem Layout
Key directories differ slightly from Linux:
- /usr/local - Local software installations
- /usr/ports - Ports collection source
- /var/db/pkg - Package database
- /etc - System configuration files (symbolic links to /usr/local/etc for some services)
๐ Essential Commands
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | |
๐ ๏ธ Common Use Cases
- Package Installation: Using
pkgfor quick software deployment - Ports Compilation: Building software from source with
/usr/ports - Service Management: Controlling system services with
servicecommand - System Monitoring: Checking resources and performance with BSD tools
๐ Troubleshooting Tips
- Check package availability with
pkg search - Verify service configuration in
/usr/local/etc/ - Use
sysctlfor runtime system tuning - Consult man pages extensively - FreeBSD documentation is comprehensive