System Commands

VritraAI provides enhanced system commands for navigation, information, and utility operations. These commands offer improved functionality over standard shell commands with better formatting, error handling, and integration with VritraAI's features.

Navigation Commands

cd <directory>

Smart directory navigation with error recovery. Automatically handles common navigation issues and provides helpful suggestions when directories don't exist. Supports path expansion for home directory (~) and environment variables ($VAR or ${VAR}).

Features:

  • Smart error handling
  • Automatic path resolution
  • Path expansion for ~ (home directory) and environment variables
  • Helpful error messages
  • Integration with VritraAI's error recovery system

Path Expansion:

VritraAI automatically expands:

  • ~ to your home directory
  • $VAR or ${VAR} to environment variable values

Examples:

# Navigate to directory
cd /home/user/projects

# Navigate to parent directory
cd ..

# Navigate to home directory (expanded automatically)
cd ~
cd ~/Documents

# Navigate using environment variables
cd $HOME/projects
cd ${HOME}/Documents

# Navigate to previous directory
cd -

Note: All file and directory commands in VritraAI support automatic path expansion for ~ and environment variables. This makes it easier to work with paths without manually expanding them.

System Information

sys_info

Comprehensive system information display. Shows operating system details, Python version, CPU information, and boot time (if psutil is available).

Information Displayed:

  • Operating system name and version
  • System release and machine type
  • Processor information
  • Python version
  • Boot time (if psutil available)
  • CPU cores (logical and physical, if psutil available)

Examples:

# Show system information
sys_info

Note: Install psutil for more detailed system information including boot time and CPU core details. The sys_info command includes robust error handling and fallback methods for Termux/Android environments, ensuring reliable system information retrieval across different platforms.

disk_usage [path]

Human-readable disk usage statistics. Shows total, used, and free disk space with percentages for any path. Supports path expansion for home directory (~) and environment variables.

Features:

  • Human-readable format (B, KB, MB, GB, TB)
  • Shows total, used, and free space
  • Percentage calculations
  • Works with any path (defaults to current directory)
  • Automatic path expansion for ~ and environment variables

Parameters:

  • path - (Optional) Path to check. Defaults to current directory (.). Supports ~ and $VAR expansion

Examples:

# Check current directory disk usage
disk_usage

# Check specific path
disk_usage /home
disk_usage /var/log

uptime

Show system uptime and boot time. Uses multiple methods to determine uptime for maximum compatibility across platforms.

Features:

  • Human-readable uptime format (days, hours, minutes, seconds)
  • Boot time display
  • Multi-method detection (works on Linux, Termux, and other systems)
  • Fallback methods for compatibility

Examples:

# Show system uptime
uptime

memory

Memory usage statistics. Shows total RAM, available memory, used memory, cached memory, and swap information (if psutil is available).

Information Displayed:

  • Total RAM
  • Available memory (with percentage)
  • Used memory (with percentage)
  • Cached memory
  • Swap total and used (if available)

Examples:

# Show memory information
memory

Requirement: This command requires psutil to be installed. Without it, memory information will not be available.

processes

Show running process information. Displays top processes sorted by CPU usage with PID, name, CPU percentage, and memory percentage.

Features:

  • Top 10 processes by CPU usage
  • Process ID (PID)
  • Process name
  • CPU usage percentage
  • Memory usage percentage

Examples:

# Show top processes
processes

Requirement: This command requires psutil to be installed.

Environment Management

env [var] [value]

Show or modify environment variables. Can display all environment variables, show a specific variable, or set a variable for the current session.

Usage Modes:

  • env - Show all environment variables
  • env <var> - Show specific environment variable
  • env <var> <value> - Set environment variable (session only)

Examples:

# Show all environment variables
env

# Show specific variable
env PATH
env HOME

# Set environment variable (session only)
env MY_VAR "value"
env DEBUG "true"

Note: Environment variables set with this command are only valid for the current VritraAI session. They do not persist after exiting.

path [add <dir>]

Show or modify PATH environment variable. Displays all PATH directories with existence indicators, or adds a directory to PATH for the current session.

Usage Modes:

  • path - Show all PATH directories with existence indicators
  • path add <dir> - Add directory to PATH (session only)

Features:

  • Shows all PATH directories
  • Indicates if each directory exists (✅ or ❌)
  • Adds directories to PATH for current session

Examples:

# Show PATH directories
path

# Add directory to PATH
path add /usr/local/bin
path add ~/bin

Note: PATH modifications are only valid for the current VritraAI session. They do not persist after exiting.

which <command>

Find the location of a command in the system PATH. Shows the full path to the executable or indicates if the command is not found.

Features:

  • Finds command location in PATH
  • Shows full path to executable
  • Indicates if command is not found

Parameters:

  • command - Command name to locate

Examples:

# Find command location
which python
which git
which vritraai

Utility Commands

time

Show current time and date information. Displays local time, date, timestamp, and UTC time.

Information Displayed:

  • Current local time (HH:MM:SS)
  • Current date (YYYY-MM-DD with day name)
  • Unix timestamp
  • UTC time

Examples:

# Show current time
time

calc <expression>

Safe mathematical calculator. Evaluates mathematical expressions with support for standard math functions.

Features:

  • Basic arithmetic operations (+, -, *, /)
  • Mathematical functions (sqrt, sin, cos, log, etc.)
  • Safe evaluation (no code execution)
  • Built-in functions (abs, round, min, max)

Supported Functions:

All functions from Python's math module are available, plus abs, round, min, and max.

Examples:

# Basic calculations
calc "2+2"
calc "10*5+3"
calc "100/4"

# Mathematical functions
calc "sqrt(16)"
calc "sin(3.14159/2)"
calc "log(100)"
calc "pow(2, 8)"

Shell Commands

clear

Clear the terminal screen. Works on both Windows and Unix-like systems.

Examples:

# Clear screen
clear

exit

Exit VritraAI with enhanced analytics summary. Shows session statistics including commands executed, AI interactions, and session duration.

Session Summary Includes:

  • Total commands executed
  • AI interactions count
  • Session duration
  • Working directory

Examples:

# Exit VritraAI
exit

help

Show comprehensive help menu with all available commands organized by category. Displays command syntax, descriptions, and usage examples.

Examples:

# Show help
help

Best Practices

  • Use sys_info: Check system information before troubleshooting
  • Monitor resources: Use memory and disk_usage to monitor system resources
  • Check processes: Use processes to identify resource-intensive applications
  • Verify commands: Use which to verify command locations
  • Manage PATH: Use path to check and manage PATH directories
  • Session variables: Remember that env and path add changes are session-only

💡 Pro Tip: Many system commands are automatically logged for the explain_last command, allowing you to get AI explanations of system command outputs.