DEV Community

Alpha Olomi
Alpha Olomi

Posted on

Termux in a nutshell

termux

According to Termux official site

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically - additional packages are available using the APT package manager.

Features

  • Secure. Access remote servers using the ssh client from OpenSSH. Termux combines standard packages with accurate terminal emulation in a beautiful open source solution.

  • Feature packed. Take your pick between Bash, fish or Zsh and nano, Emacs or Vim. Grep through your SMS inbox. Access API endpoints with curl and use rsync to store backups of your contact list on a remote server.

  • Customizable. Install what you want through the APT package management system known from Debian and Ubuntu GNU/Linux. Why not start with installing Git and syncing your dotfiles?

  • Explorable. Have you ever sat on a bus and wondered exactly which arguments tar accepts? Packages available in Termux are the same as those on Mac and Linux - install man pages on your phone and read them in one session while experimenting with them in another.

  • With batteries included. Can you imagine a more powerful yet elegant pocket calculator than a readline-powered Python console? Up-to-date versions of Perl, Python, Ruby and Node.js are all available.

  • Ready to scale up. Connect a Bluetooth keyboard and hook up your device to an external display if you need to - Termux supports keyboard shortcuts and has full mouse support.

  • Tinkerable. Develop by compiling C files with Clang and build your own projects with CMake and pkg-config. Both GDB and strace are available if you get stuck and need to debug.

Credits: Termux Official Site at https://termux.com/

God to know

  • Termux is an Android terminal emulator and Linux environment application
  • Termux is single-user
  • Root file system is stored as ordinary application data
  • Termux does not follow Linux Filesystem Hierarchy Standard unlike majority of Linux distributions. You cannot find directories like /bin, /etc, /usr, /tmp and others at usual location.

Common Softwares

pkg in git
pkg in nodejs
Enter fullscreen mode Exit fullscreen mode
pkg in root-repo        # 
pkg in unstable-repo    #
pkg in x11-repo         # x11
pkg in proot            # use classical Linux file system layout
Enter fullscreen mode Exit fullscreen mode

Installing Zsh shell

pkg in zsh
Enter fullscreen mode Exit fullscreen mode

Ohh My Zsh - Basic Installation

Oh My Zsh is installed by running one of the following commands in your terminal. You can install this via the command-line with either curl or wget should be installed

git should be installed (recommended v1.7.2 or higher)

via curl

sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

via wget

Enter fullscreen mode Exit fullscreen mode


sh
sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"


---

## Zsh Plugins 

1. zsh-autosuggestions

- Clone this repository into `$ZSH_CUSTOM/plugins` (by default `~/oh-my-zsh/custom/plugins`)
Enter fullscreen mode Exit fullscreen mode


sh
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

- Add the plugin to the list of plugins for Oh My Zsh to load (inside `~/zshrc`):
Enter fullscreen mode Exit fullscreen mode


ini
plugins=(zsh-autosuggestions)

- Start a new terminal session.



2. zsh-syntax-highlighting

- Download zsh-syntax-highlighting by

Enter fullscreen mode Exit fullscreen mode


sh
git clone https://github.com/zsh-users/zsh-syntax-highlighting.gitZSH_CUSTOM/plugins/zsh-syntax-highlighting


- `nano ~/.zshrc` find `plugins=(git)`

- Append `zsh-autosuggestions & zsh-syntax-highlighting` to  `plugins()` like this 

Enter fullscreen mode Exit fullscreen mode


ini
plugins=(git zsh-autosuggestions zsh-syntax-highlighting)


- Reopen terminal


### Ref
 - [oh-my-zsh](https://github.com/robbyrussell/oh-my-zsh)
 - [zsh-autosuggestions](https://github.com/zsh-users/zsh-autosuggestions)
 - [zsh-syntax-highlighting](https://github.com/zsh-users/zsh-syntax-highlighting)
 - [https://gist.github.com/kevin-smets/8568070](https://gist.github.com/kevin-smets/8568070)



----
## Termux Styling


Enter fullscreen mode Exit fullscreen mode


sh
cd ~ # change to Home Dir
git clone https://github.com/adi1090x/termux-style.git


- Change to cloned directory
Enter fullscreen mode Exit fullscreen mode


sh
cd termux-style


-  Make script executable
Enter fullscreen mode Exit fullscreen mode


sh
chmod +x setup


- Run setup to finally install it
Enter fullscreen mode Exit fullscreen mode


sh
./setup


Ref: https://github.com/adi1090x/termux-style


----
## Working with packages

### Installing packages from APT repository

In Termux it is recommended to use package manager `pkg` which is a wrapper for `apt`. 

>It simplifies installing or upgrading packages by automatically updating apt lists so you don't have to type apt update when installing or upgrading packages.



#### Install package:

Enter fullscreen mode Exit fullscreen mode


sh
pkg install package_name


#### Remove package:

Enter fullscreen mode Exit fullscreen mode


sh
pkg uninstall package_name


#### List all packages:

Enter fullscreen mode Exit fullscreen mode


sh
pkg list-all


#### Upgrading packages:

Enter fullscreen mode Exit fullscreen mode


sh
pkg upgrade



For more information about available commands you can either just run pkg without arguments or like this: `pkg help`.

---

### Manual installation of `*.deb` files

If you have a `*.deb` package file, you can install it with `dpkg`. 

>Note that packages downloaded from *Ubuntu or from repositories of other Linux distributions will not work due to incompatible libc ABI*, however statically compiled binaries may work.


#### Installing:

Enter fullscreen mode Exit fullscreen mode


sh
dpkg -i ./package.deb


#### Uninstalling:

Enter fullscreen mode Exit fullscreen mode


sh
dpkg --remove package_name


#### Listing all installed packages:

Enter fullscreen mode Exit fullscreen mode


sh
dpkg -l




Since dpkg has many useful options, you may want to see it's manual via `man dpkg`.

Ref: https://wiki.termux.com/wiki/Package_Management


--- 

Enter fullscreen mode Exit fullscreen mode

Top comments (0)