Back to course

Linking Internal Storage for Easy Access

Termux Masterclass: From Zero to Linux Power User on Android

22. Linking Internal Storage for Easy Access

While the ~/storage folder is useful, navigating deep paths can be tedious. Using symbolic links (ln -s) can create convenient shortcuts.

Understanding Symbolic Links (ln -s)

A symbolic link (or symlink) is a special file that points to another file or directory, just like a shortcut on a desktop OS.

Syntax: ln -s [target_path] [link_name]

Creating a Shortcut to Downloads

Instead of typing cd ~/storage/downloads/, let's create a direct link called mydownloads in the home directory.

bash

Ensure you are in the home directory

$ cd ~

Create a symlink named 'mydownloads' pointing to the actual downloads folder

$ ln -s storage/downloads mydownloads

$ ls -l mydownloads lrwxrwxrwx 1 u0_a... u0_a... 17 Jun 1 10:00 mydownloads -> storage/downloads/

Now, you can jump directly to your Android Downloads folder from anywhere by typing:

bash $ cd mydownloads

Practical Example: Script Execution

If you download a Python script (runme.py) to your Android Downloads folder, you can run it directly from Termux:

bash $ cd mydownloads $ python runme.py

This bridging of the Linux environment with the Android file system is crucial for mobile productivity.