Reference
Commands Cheatsheet
Every useful command for NetLens — from daily operations to full recovery — collected in one place. Click the copy button on any command to copy it.
Deploy and start
sudo ./install.shBuild the image and start the stack (first run only).
docker compose up -dStart the stack without rebuilding.
docker compose up -d --buildRebuild the image and start.
docker compose downStop the container and release the bind mounts.
docker stop netlensQuick stop that keeps the mounts.
docker start netlensQuick start.
docker restart netlensRestart the container.
docker compose psCheck container status.
docker logs --tail=50 netlensView the last 50 lines of container logs.
NfSen daemon
docker exec netlens /var/nfsen/bin/nfsen statusCheck whether the NfSen daemon is running.
docker exec netlens /var/nfsen/bin/nfsen startStart the NfSen daemon.
docker exec netlens /var/nfsen/bin/nfsen stopStop the NfSen daemon.
docker exec netlens /var/nfsen/bin/nfsen restartRestart the NfSen daemon.
docker exec netlens /var/nfsen/bin/nfsen reconfigApply config changes to the running daemon.
Router sources
docker exec netlens grep -A 20 '%sources' /var/nfsen/etc/nfsen.confList all configured sources.
docker exec netlens bash -c "sed -i \"/^);$/i\\ 'NAME' => { 'port' => '2055', 'IP' => 'IP_ADDRESS', 'col' => '#COLOR', 'type' => 'netflow' },\" /var/nfsen/etc/nfsen.conf && /var/nfsen/bin/nfsen reconfig && echo 'Done'"Add a source with an IP (replace NAME, IP_ADDRESS, COLOR).
docker exec netlens bash -c "sed -i \"/'NAME' =>/d\" /var/nfsen/etc/nfsen.conf && /var/nfsen/bin/nfsen reconfig && echo 'Removed'"Remove a source (replace NAME).
docker exec netlens bash -c "sed -i \"/'router1' =>/d\" /var/nfsen/etc/nfsen.conf && /var/nfsen/bin/nfsen reconfig && echo 'Removed'"Remove the demo router1 source.
Password management
docker exec netlens htpasswd -b /var/nfsen/etc/.htpasswd admin <newpass>Change the admin password — instant, no restart.
Data retention
docker exec netlens /var/nfsen/bin/nfsen --modify-profile live expire=30d maxsize=15GSet retention from the command line (30 days / 15 GB example).
Disk recovery
docker system prune -fFree Docker disk space.
docker builder prune -fFree Docker build cache.
sudo journalctl --vacuum-time=1dClean system logs when the disk is full.
docker exec netlens bash -c "rm -rf /var/nfsen/profiles-data/live/* /var/nfsen/profiles-stat/live/*"Delete all flow data and graphs (frees the most space).
docker exec netlens bash -c "truncate -s 0 /var/nfsen/var/nfsen.log"Truncate the NfSen log file.
LibreNMS integration
sudo apt install -y nfs-kernel-serverInstall the NFS server (run on the NetLens VPS).
sudo apt install -y nfs-commonInstall the NFS client (run on the LibreNMS server).
sudo mount -t nfs4 <VPS_IP>:<path>/nfsen-data /var/nfsen/profiles-dataMount the NFS data share on the LibreNMS server.
/usr/local/bin/nfdump -VVerify the nfdump version (must be 1.6.25).
lnms config:set nfsen_enable trueEnable the Netflow tab in LibreNMS.
lnms config:set nfsen_suffix '_none'Set the required non-empty suffix (never leave empty).
Utility
ss -lunp | grep -E '2055|2056|8070'Check that the UDP listeners and web UI port are active.
tar czf nfsen-backup.tar.gz nfsen-data nfsen-stat nfsen-var nfsen-etcBack up all four data folders.
docker inspect netlensInspect the container (see the Mounts section for bind mounts).
df -h /Check available disk space.