Last active
November 11, 2025 08:35
-
-
Save pharmankur/bedaf9924c349f353ef4609230a974e7 to your computer and use it in GitHub Desktop.
BASH Script - Easy Install signal-cli in linux [ debian / Ubuntu / Linux Mint ] and Link it to SIGNAL mobile app , with easy to use alias [ viz signal-cli-login and signal-cli-status ]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # filename - ~/Install_Signal-cli_for_Linux_Terminal.sh | |
| # make executable - chmod 755 ~/Install_Signal-cli_for_Linux_Terminal.sh | |
| # run file - bash -i ~/Install_Signal-cli_for_Linux_Terminal.sh | |
| # run this script in INTERACTIVE mode ONLY [ in order to properly configure ALIAS ] . This is ensured by mentioning -i in " bash -i ~/Install_Signal-cli_for_Linux_Terminal.sh " | |
| User=$(whoami) && | |
| now=$(date +"%F/%T") && | |
| echo " | |
| This script will install signal-cli and enable you to link signal-cli to your registered mobile having SIGNAL Installed | |
| " && | |
| sleep 2 && | |
| echo " | |
| This script consideres you are using debian based distro like UBUNTU / Linux Mint | |
| " && | |
| sleep 2 && | |
| echo " | |
| Before proceeding , ensure that have already installed and registered SIGNAL APP on your mobile [ A MUST ] | |
| " && | |
| sleep 2 && | |
| echo " | |
| Once the signal-cli is installed, you can send signal messages using linux terminal. | |
| " && | |
| sleep 3 && | |
| clear && | |
| ### Update and install some essentials | |
| sudo apt-get update && | |
| sudo apt-get install -y ca-certificates curl gnupg wget qrencode ; | |
| clear && | |
| echo " | |
| Removing previously signal-cli downloaded binary files [If Any] | |
| " && | |
| sleep 2 && | |
| ### Remove previous signal-cli version if any. | |
| cd ~ ; | |
| rm ~/signal-cli* ; sudo rm /usr/bin/signal-cli* ; # remove previously downloaded binary files [If Any] | |
| clear && | |
| ### Fetch and download LATEST version | |
| echo " | |
| Fetch and download the latest release version of signal-cli-Linux-native.tar.gz | |
| " && | |
| sleep 2 && | |
| # Fetch the latest release version | |
| latest_version=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed 's/.*\///') | |
| # Remove the 'v' prefix from the version number | |
| version=${latest_version#v} | |
| # Construct the download URL | |
| download_url="https://github.com/AsamK/signal-cli/releases/download/${latest_version}/signal-cli-${version}-Linux-native.tar.gz" ; | |
| # Download file | |
| wget "$download_url" ; | |
| clear && | |
| #### Download latest version using single line command [ Practically does the same thing as done above ] ## It works, but is commented out and just used as reference. --->> | |
| # wget "https://github.com/AsamK/signal-cli/releases/download/$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed 's/.*\///')/signal-cli-$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed 's/.*\///' | sed 's/^.//')-Linux-native.tar.gz" | |
| #### using single line command END <<--- | |
| ### extract and install signal-cli | |
| sudo tar xf signal-cli*.tar.gz -C ~/ # unzip binary file to user home | |
| sudo chmod +x ~/signal-cli ; # make signal-cli executable | |
| sudo mv ~/signal-cli /usr/bin/ ; # move and copy executable to bin | |
| # sudo mv /usr/bin/signal-cli-"${VERSION}" /usr/bin/signal-cli ; # rename utility simply to signal-cli [ from signal-cli-"${VERSION}" ] so as, in terminal typing signal-cli will execute the program | |
| echo "signal-cli is UPDATED to version " ; | |
| signal-cli --version ; # Shows updated version | |
| sleep 3 && | |
| clear ; | |
| ### CREATE alias for signal-cli for easy login and easy status viewing ------> START | |
| ## Following are useful signal-cli commands which are converted in easy to use commands using alias | |
| # signal-cli listAccounts # Shows status of logged in device and shows the mobile no which is used for signal-cli login | |
| # signal-cli listDevices # Shows device names which are associated with device login | |
| # signal-cli link -n "Linux Terminal for signal-cli" | tee >(xargs -L 1 qrencode -t utf8) # Generates qrcode for device login. Generated QRCODE should be scanned from mobile SIGNAL app. | |
| ## This step work well only in interactive mode [ if not run in interactive mode, multiple instances of alias will get created in ~/,bashrc file , which then needs to be manually removed ] --> | |
| if alias signal-cli-login >/dev/null 2>&1; then | |
| { clear ; | |
| echo "signal-cli-login is already set as an alias" ; | |
| sleep 3 ; } | |
| else | |
| { now=$(date +"%F/%T") ; | |
| echo "### set alias to use signal-cli more easily [ set at $now ] | |
| # alias for login a new device showing qrcode [ EXPECTS that qrencode is already installed ] | |
| alias signal-cli-login='signal-cli link -n \"Linux Terminal for signal-cli\" | tee >(xargs -L 1 qrencode -t utf8)' # Generates qrcode for device login. Generated QRCODE should be scanned from mobile SIGNAL app. | |
| # alias for showing login device details | |
| alias signal-cli-status='signal-cli listAccounts && signal-cli listDevices' # Shows status of logged in device and shows the mobile no which is used for signal-cli login && Shows device names which are associated with device login | |
| " | tee -a ~/.bashrc ; } ## updates new aliases in ~/.bashrc file | |
| fi # Sets alias only if those are not present. | |
| source ~/.bashrc ; ### Activates the alias in the current session | |
| echo "You can use signal-cli-me to know login status" ; | |
| sleep 3 && | |
| echo "You can use signal-cli-login to login a new device" ; | |
| sleep 3 && | |
| ### CREATE alias for signal-cli for easy login and easy status viewing ------> END | |
| User=$(whoami) ; | |
| echo $User is now tuned \for sending message on signal app using signal-cli $(signal-cli --version) ; | |
| sleep 3 && | |
| clear ; | |
| echo "You can check logged in user details by using signal-cli-status " | |
| signal-cli listAccounts && signal-cli listDevices ; # ALIAS signal-cli-status | |
| sleep 5 && | |
| clear ; | |
| echo " You can connect this instance of SIGNAL-CLI to your SIGNAL mobile app by using command signal-cli-login" ; | |
| sleep 3 && | |
| echo " Go to SIGNAL mobile app, go to Settings > Linked Devices, and tap Link New Device--> Use your phone's camera to scan the QR code displayed on the computer or tablet's screen" ; | |
| sleep 3 && | |
| signal-cli link -n "Linux Terminal for signal-cli" | tee >(xargs -L 1 qrencode -t utf8) ; # ALIAS signal-cli-login | |
| sleep 3 && | |
| clear ; | |
| echo "You can check logged in user details by using signal-cli-status " | |
| signal-cli listAccounts && signal-cli listDevices ; # ALIAS signal-cli-status | |
| sleep 5 && | |
| clear ; | |
| echo "You can send message from your logged in number using syntax | |
| signal-cli -u +YOUR_COUNTRY_CODE_AND_PHONE_NUMBER send -m \"Welcome to SIGNAL\" +RECIPIENT_COUNTRY_CODE_AND_PHONE_NUMBER | |
| e.g. [ if YOUR_COUNTRY_CODE_AND_PHONE_NUMBER = +4915151111111 and RECIPIENT_COUNTRY_CODE_AND_PHONE_NUMBER = +4915152222222 ] | |
| signal-cli -u +4915151111111 send -m \"Welcome to SIGNAL\" +4915152222222 | |
| For further details refer | |
| https://github.com/AsamK/signal-cli/wiki/Quickstart | |
| https://github.com/AsamK/signal-cli | |
| " ; | |
| ## Open reference link | |
| xdg-open https://github.com/AsamK/signal-cli/wiki/Quickstart | |
| sleep 20 && | |
| ##### Exit #### | |
| exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment