Skip to main content

Command line tools

This page introduces how to use LibCyber's command line tool cyber.

Install

The latest version: v1.1.0

reminder

It is recommended to install it under the root user (non-sudo) under Linux. Otherwise, permission problems may occur when setting up auto-start at boot and turning on TUN mode.

wget -O getcyber.sh getcyber.sh && bash getcyber.sh

Manual installation (for use in restricted environments)

reminder

If your system environment does not have real sudo permissions, cannot access dbus, is in a container (which may be encountered when using a shared GPU or AI model rental service), cannot use the systemd service, etc., follow the steps below to install it. Note that the cyber core installed in this way will not start automatically at boot. After each restart of the server, you need to manually execute cyber core start before it can be used normally.

# Download
wget https://getcyber.sh/cyber.tar.gz -O cyber.tar.gz

# Unzip
tar -zxvf cyber.tar.gz

# Enter directory
cd cyber

# Add executable permissions
sudo chmod +x cyber

# Move to the environment variable PATH directory
sudo mv cyber /usr/bin/

# Login (enter username and password interactively)
cyber login

# Initialize cyber configuration
cyber init

use

cyber --help

Long story short

# 1. Get proxy configuration instructions.
cyber proxy shell

# 2. Copy the output result of the above command and execute it.
# export http_proxy=http://127.0.0.1:8890;export https_proxy=http://127.0.0.1:8890;export all_proxy=socks5://127.0.0.1:8891

# 3. Use curl, wget and other commands to test whether the proxy is effective.
curlip.sb

# 2. Learn how to use LibCyber proxy.
cyber proxy readme

# If you do not want to manually configure the proxy, you can enable TUN mode to automatically take over all traffic in the system (experimental)
#cybertunnelon

Detailed introduction

# Interactive login
cyber login

# Pass in the user name and password to log in through command line parameters.
cyber login -u <username> -p <password>

# Sign out
cyber logout

# View current login account information
cyber info
# Download node configuration
cyber node download

# Update node configuration
cyber node update

# View node list
cyber node list

# Switch nodes
cyber node change <node name>

# Batch delay test
cyber node benchmark
# Download traffic forwarding program
cyber core download

# Start the traffic forwarding program
cyber core start

# Stop the traffic forwarding program
cyber core stop

# Check the running status of the traffic forwarding program
cyber core status

# Auto-start at boot (only supports Linux, and the Systemd service needs to be installed with root privileges first. For details, see the relevant instructions for the Systemd service below)
cyber core enable

# Cancel auto-start at boot (only supports Linux, and the Systemd service needs to be installed with root privileges first. For details, see the Systemd service instructions below)
cyber core disable
# View routing mode
cyber mode show

# Switch the routing mode. The routing mode name is rule or global.
cyber mode change <routing mode name>
# View proxy port information
cyber proxy info

# Configure git agent
cyber proxy git
# Cancel git agent
cyber proxy unset git

# Configure npm proxy
cyber proxy npm
# Cancel npm proxy
cyber proxy unset npm

# Configure yarn proxy
cyber proxy yarn
# Cancel yarn proxy
cyber proxy unset yarn

# View more proxy settings instructions
cyber proxy readme

# Turn on and off TUN mode
cyber tunnel on
cyber tunnel off
#Install and delete Systemd service
cyber service install
cyber service uninstall

Configuration management

# Open and edit the configuration file
cyber config edit

# Turn on and off API Endpoint key access
cyber config secret on
cyber config secret off

Chinese, switch language

# Switch to Chinese (translation is incomplete)
cyber language zh

# Switch to English
cyber language en

View version

cyber version
#bash
cyber completion bash > /etc/bash_completion.d/cyber

#zsh
cyber completion zsh > "${fpath[1]}/_cyber"

#fish
cyber completion fish > ~/.config/fish/completions/cyber.fish

It will take effect after restarting the terminal.

Other functions

# Troubleshooting
cyber doctor

# Delete all configuration files and user data
cyber purge

View help

cyber --help

Stop and delete with one click

Prepare a script file, such as cyber-remove.sh, with the following content:

#!/bin/bash
set -e

cyber core stop
cyber purge -f

rm -rf /usr/bin/cyber /usr/bin/cyber-core /usr/local/bin/cyber /usr/local/bin/cyber-core
rm -rf /usr/local/cyber/ ~/.cyber/core/ /etc/cyber-core/ /etc/cyber/ /var/log/cyber-core/ /var/log/cyber/

rm -f /etc/systemd/system/cyber-core.service
systemctl daemon-reload
systemctl reset-failed

echo "Cyber has been removed successfully."

Execute the following command:

chmod +x cyber-remove.sh
./cyber-remove.sh

common problem

1. After installation, an error message appears when running: cyber: command not found?

Please check whether /usr/bin is included in the current Linux environment variables. If not, please add it manually. First execute export PATH=$PATH:/usr/bin to add it to the current terminal session, and then execute cyber --help again to see if it is normal. This method is only valid in the current terminal session. If it needs to be permanent, please add export PATH=$PATH:/usr/bin to ~/.bashrc or ~/.zshrc (the shell configuration file you use ), and then execute source ~/.bashrc or source ~/.zshrc to make it effective.

2. Unable to connect to the network after restarting the server

If it is configured according to the manual installation steps, cyber-core will not start automatically at boot. You need to manually execute cyber core start (or ensure that the systemd service in the system has been installed and used normally, and then execute cyber service install and cyber core enableuses the auto-start function at boot).

3. Security enhancement

If you are worried about encountering cross-domain attacks against the cyber core while surfing the Internet, you can run cyber config edit to modify the configuration file of the cyber core, and change the xxx part of external-controller: 127.0.0.1:xxx to the range of 1000-65535 any other number (or run cyber config secret on), then restart cyber core via cyber core restart