A powerful command-line tool for tracking device location across multiple platforms. Track your Linux, macOS, Windows, Android, or iOS device with ease using free or self-hosted tracking providers.
π Quick Start: Install in 2 minutes | π Free Forever | π Works Everywhere | π Privacy-Focused
Zero configuration required! GPS-CLI works immediately with:
- FREE Traccar Demo Server (
https://demo2.traccar.org
) - NO account or signup needed! - IP-Based Geolocation - NO GPS hardware required (city-level accuracy)
- Instant Setup - Just run
gps setup
and you're tracking in seconds
Perfect for testing, personal use, or getting started quickly. Want more precision or privacy? Easily switch to self-hosted options or GPS hardware later!
π Multi-Provider Support
- Traccar (Free demo server + self-hosted)
- OwnTracks (Privacy-focused MQTT/HTTP)
- PhoneTrack (Nextcloud integration)
- GPSLogger (Custom HTTP endpoints)
π‘ Flexible Location Sources
- IP-based geolocation (works anywhere)
- GPS hardware support (via gpsd)
- Automatic fallback mechanisms
πΊοΈ Web-Based Tracking
- Real-time map visualization
- Shareable tracking URLs
- Works on any device with a browser
βοΈ Highly Configurable
- Adjustable update intervals
- Background tracking daemon
- Privacy-focused local storage
π¨ User-Friendly Interface
- π NEW: Interactive menu mode (run
gps
without arguments) - Beautiful color-coded menu with 8 options
- Continuous loop - no need to restart between operations
- All prompts show default values
- Simple command structure for CLI automation
- Comprehensive help system
π Location History
- Track last 50 locations
- Timestamped entries
- Easy history review
π Privacy & Security
- All configuration stored locally
- Self-hosted options available
- No data sharing required
Core Dependencies:
bash
(version 4.0+)curl
(for API requests)jq
(for JSON parsing)
Optional:
gpsd
andcgps
(for GPS hardware support)
Debian/Ubuntu/Kali:
sudo apt-get update
sudo apt-get install -y bash curl jq
# Optional: for GPS hardware
sudo apt-get install -y gpsd gpsd-clients
macOS:
brew install bash curl jq
# Optional: for GPS hardware
brew install gpsd
Arch Linux:
sudo pacman -S bash curl jq gpsd
cd /home/kali/labs
git clone https://github.com/yourusername/gps-cli.git
cd gps-cli
./install.sh
# Make script executable
chmod +x gps
# Create symlink
mkdir -p ~/.local/bin
ln -s $(pwd)/gps ~/.local/bin/gps
# Add to PATH (if not already)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc # or ~/.bashrc
source ~/.zshrc
gps help
Simply run gps
without any arguments to launch the beautiful interactive menu:
gps
You'll see a menu like this:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π°οΈ GPS CLI - Universal Device Location Tracker v0.3.0 β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
[1] π§ Setup Tracking Provider - Configure Traccar, OwnTracks, etc.
[2] βΆοΈ Start Tracking - Begin sending location updates
[3] βΉοΈ Stop Tracking - Stop location updates
[4] π Show Status - View tracking status and last location
[5] πΊοΈ Show Tracking URL - Display web tracking link
[6] βοΈ Configure Settings - Adjust update interval and options
[7] π View Location History - Show recent location updates
[8] π‘ List Providers - Show available tracking providers
[0] πͺ Exit - Quit GPS CLI
Features:
- π Continuous loop - no need to restart between operations
- β¨οΈ Simple number-based navigation
- π¨ Color-coded menu items for easy identification
- βοΈ All prompts show default values
- βC Graceful exit with Ctrl+C
First Time Setup (via Interactive Menu):
- Select option
[1]
to setup tracking provider - Choose Traccar (option 1)
- Select FREE demo server (default)
- Enter a device name (or press Enter for auto-generated)
- Back to main menu - select
[2]
to start tracking - Select
[5]
to get your tracking URL - Open the URL in a browser to see your device on the map!
Prefer commands? All CLI functionality is still available:
gps setup
Choose Traccar (option 1), select the FREE demo server, and give your device a name (e.g., "my-laptop" or "gps-tracker")!
The device name will be used to identify your device in the Traccar dashboard.
gps start
gps url
Open the URL in any web browser to see your device on a map!
gps status
gps stop
Command | Alias | Description |
---|---|---|
gps setup |
- | Configure tracking provider |
gps start |
- | Start GPS tracking |
gps stop |
- | Stop GPS tracking |
gps status |
s |
Show tracking status and location |
gps url |
link |
Display tracking URL |
gps config |
configure |
Configure update interval |
gps history |
h |
Show location history |
gps providers |
list |
List available providers |
gps help |
-h , --help |
Show help message |
Start tracking with default settings:
gps start
Check your current status:
gps status
Get tracking URL to share:
gps url
Change update interval to 30 seconds:
gps config
# Enter: 30
View location history:
gps history
List all providers:
gps providers
Best for: Everyone - Easiest setup with free demo server
Setup:
- Run
gps setup
- Select option
1
(Traccar) - Select option
1
(Free demo server) - Enter a device name (e.g., "gps-tracker") or press Enter for auto-generated name
- Done! Your tracking URL will be displayed
Features:
- β Free demo server (no registration)
- β Web-based map interface
- β Real-time tracking
- β Custom device names for easy identification
- β Osmand protocol for better device management
- β Self-hosted option available
Web Interface:
- Demo server: https://demo2.traccar.org
- Login not required for viewing
- Just use your device ID in the URL
Self-Hosting Traccar:
# Docker installation
docker run -d --name traccar \
-p 8082:8082 \
-p 5055:5055 \
traccar/traccar:latest
Then configure GPS CLI to use http://your-server:8082
Best for: Privacy-conscious users with technical expertise
Requirements:
- MQTT broker (Mosquitto) or HTTP endpoint
- Self-hosted OwnTracks Recorder for web interface
Setup:
- Install Mosquitto MQTT broker
- Install OwnTracks Recorder
- Run
gps setup
and select OwnTracks - Enter your endpoint URL
Installation (Server):
# Install Mosquitto
sudo apt-get install mosquitto mosquitto-clients
# Install OwnTracks Recorder
# See: https://github.com/owntracks/recorder
Features:
- β End-to-end encryption
- β Privacy-focused
- β MQTT or HTTP support
β οΈ Requires own server
Best for: Nextcloud users
Requirements:
- Nextcloud instance
- PhoneTrack app installed
Setup:
- Install PhoneTrack on your Nextcloud
- Create a tracking session
- Get session token from PhoneTrack
- Run
gps setup
and select PhoneTrack - Enter Nextcloud URL and session token
Installation (Nextcloud):
# Install via Nextcloud app store or:
sudo -u www-data php occ app:install phonetrack
Features:
- β Integrated with Nextcloud
- β Session-based tracking
- β Privacy-first design
β οΈ Requires Nextcloud
Best for: Custom integrations and developers
Requirements:
- HTTP endpoint that accepts POST requests
Setup:
- Set up your custom endpoint
- Run
gps setup
and select GPSLogger - Enter endpoint URL and auth token
Example Backend (Node.js/Express):
app.post('/gps/update', (req, res) => {
const { device_id, latitude, longitude, timestamp } = req.body;
// Store location in your database
res.json({ success: true });
});
Features:
- β Maximum flexibility
- β Custom integrations
- β Any HTTP endpoint
β οΈ DIY implementation
Option 1: Traccar Client (Recommended)
- Install "Traccar Client" from Google Play Store
- Open app β Settings
- Set Device Identifier to your GPS CLI device ID
- Set Server Address:
https://demo2.traccar.org:5055
- Start tracking
Option 2: GPSLogger for Android
- Install "GPSLogger" from F-Droid or Google Play
- Configure custom URL endpoint
- Enable automatic logging
OwnTracks for iOS
- Install "OwnTracks" from App Store
- Configure HTTP endpoint or MQTT broker
- Set device ID and credentials
- Start tracking
- Traccar Manager - iOS/Android management app
- PhoneTrack - Nextcloud mobile app
- Any app that can POST to HTTP endpoints
All configuration is stored in ~/.config/gps-cli/
:
config.json
- Main configurationhistory.json
- Location historygps.log
- Application logs.env
- Provider credentials (optional)tracker.pid
- Background process ID
Copy .env.sample
to ~/.config/gps-cli/.env
for advanced configuration:
cp .env.sample ~/.config/gps-cli/.env
nano ~/.config/gps-cli/.env
Key Settings:
# Update interval (seconds)
UPDATE_INTERVAL=60
# GPS source (auto, ip, hardware)
GPS_SOURCE=auto
# Provider selection
GPS_PROVIDER=traccar
# Interactive configuration
gps config
# Common intervals:
# 30 = 30 seconds (high frequency)
# 60 = 1 minute (default, balanced)
# 300 = 5 minutes (battery saving)
# 600 = 10 minutes (low frequency)
Check dependencies:
which curl jq
Check configuration:
cat ~/.config/gps-cli/config.json
Check logs:
tail -f ~/.config/gps-cli/gps.log
Verify background process:
gps status
Check IP geolocation APIs:
curl -s https://ipapi.co/json/ | jq
Restart tracking:
gps stop
gps start
Traccar demo server:
- URL format:
https://demo2.traccar.org/?id=YOUR_DEVICE_NAME
- Device must send at least one location update first
- Wait 1-2 minutes after starting tracking
- Device will appear in the dashboard with the name you chose during setup
Self-hosted:
- Verify server is accessible
- Check firewall rules
- Ensure correct port configuration
Make script executable:
chmod +x ~/.local/bin/gps
Check PATH:
echo $PATH | grep .local/bin
Install gpsd:
sudo apt-get install gpsd gpsd-clients
Check GPS device:
lsusb # Look for GPS device
cgps # Test GPS reception
Start gpsd:
sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock
- Local only: All configuration stored in
~/.config/gps-cli/
- No cloud sync: Data never leaves your device (unless you configure it)
- Open source: Audit the code yourself
- Approximate: City-level accuracy (5-50km radius)
- Third-party APIs: ipapi.co and ip-api.com
- Limited data: Only IP address sent to geolocation APIs
- Fallback: Multiple providers for reliability
Provider | Privacy Level | Data Storage | Encryption |
---|---|---|---|
Traccar (demo) | Demo server | HTTPS | |
Traccar (self-hosted) | β Private | Your server | HTTPS |
OwnTracks | β Private | Your server | End-to-end |
PhoneTrack | β Private | Your Nextcloud | HTTPS |
GPSLogger | π€· Depends | Your endpoint | Your choice |
- For maximum privacy: Use self-hosted OwnTracks or Traccar
- For testing: Traccar demo is fine (temporary use)
- For existing setup: PhoneTrack if you already use Nextcloud
- For custom needs: GPSLogger with your own backend
- Fully supported
- All providers available
- GPS hardware support via gpsd
- Fully supported
- All providers available
- Limited GPS hardware support
- Supported via WSL or MSYS2
- All providers available
- No GPS hardware support
- Use Traccar Client app
- Configure with same device ID
- Points to same tracking URL
- Use OwnTracks app
- Requires MQTT/HTTP setup
- Alternative: Traccar iOS app
- Track your laptop when traveling
- Find lost devices
- Monitor device location history
- Track company equipment
- Monitor fleet vehicles (with GPS hardware)
- Logistics and delivery tracking
- Test location-based applications
- Simulate device movement
- API integration testing
- Emergency location tracking
- Anti-theft monitoring
- Backup location tracking
Contributions are welcome! Here's how you can help:
- Report bugs: Open an issue
- Suggest features: Start a discussion
- Submit PRs: Fork, code, and create pull request
- Improve docs: Fix typos, add examples
- Share providers: Add support for new tracking services
This project is free and open-source. Use, modify, and distribute as you wish.
- Traccar: Excellent open-source GPS tracking platform
- OwnTracks: Privacy-focused location tracking
- PhoneTrack: Great Nextcloud integration
- IP Geolocation APIs: ipapi.co and ip-api.com
- Documentation: This README
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Logs: Check
~/.config/gps-cli/gps.log
- Device naming support
- Osmand protocol for Traccar
- Improved IP geolocation stability
- Better error handling and timeouts
- JSON parsing fixes
- Enhanced GPS hardware support
- Multiple device tracking
- Geofencing alerts
- Export location data (CSV, KML)
- Web dashboard
- Bluetooth beacon support
- Wi-Fi positioning
- Battery optimization modes
- Encryption for all providers
- Mobile app companion
Current version: 0.2.0
See CHANGELOG.md for version history.
Made with β€οΈ for privacy-conscious device tracking
π°οΈ Track responsibly | π Privacy matters | π Location everywhere