diff --git a/include/pathnames.h b/include/pathnames.h
index 34ba11ca3..a7d3278c8 100644
--- a/include/pathnames.h
+++ b/include/pathnames.h
@@ -19,77 +19,78 @@
 /* DEFPATHs from <paths.h> don't include /usr/local */
 #undef _PATH_DEFPATH
 
-#ifdef USE_USRDIR_PATHS_ONLY
-# define _PATH_DEFPATH	        "/usr/local/bin:/usr/bin"
-#else
-# define _PATH_DEFPATH	        "/usr/local/bin:/bin:/usr/bin"
-#endif
+# define _PATH_DEFPATH		"@TERMUX_PREFIX@/bin"
 
 #undef _PATH_DEFPATH_ROOT
 
-#ifdef USE_USRDIR_PATHS_ONLY
-# define _PATH_DEFPATH_ROOT	"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
-#else
-# define _PATH_DEFPATH_ROOT	"/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
-#endif
+# define _PATH_DEFPATH_ROOT	_PATH_DEFPATH
 
 #define	_PATH_HUSHLOGIN		".hushlogin"
-#define	_PATH_HUSHLOGINS	"/etc/hushlogins"
+#define	_PATH_HUSHLOGINS	"@TERMUX_PREFIX@/etc/hushlogins"
 
-#define _PATH_NOLOGIN_TXT	"/etc/nologin.txt"
+#define _PATH_NOLOGIN_TXT	"@TERMUX_PREFIX@/etc/nologin.txt"
 
 #ifndef _PATH_MAILDIR
-# define _PATH_MAILDIR		"/var/spool/mail"
+# define _PATH_MAILDIR		"@TERMUX_PREFIX@/var/spool/mail"
 #endif
-#define	_PATH_MOTDFILE		"/usr/share/misc/motd:/run/motd:/etc/motd"
+#define	_PATH_MOTDFILE		"@TERMUX_PREFIX@/etc/motd"
 #ifndef _PATH_NOLOGIN
-# define _PATH_NOLOGIN		"/etc/nologin"
+# define _PATH_NOLOGIN		"@TERMUX_PREFIX@/etc/nologin"
 #endif
-#define	_PATH_VAR_NOLOGIN	"/var/run/nologin"
+#define	_PATH_VAR_NOLOGIN	"@TERMUX_PREFIX@/var/run/nologin"
 
 #ifndef _PATH_LOGIN
-# define _PATH_LOGIN		"/bin/login"
+# define _PATH_LOGIN		"@TERMUX_PREFIX@/bin/login"
 #endif
-#define _PATH_SHUTDOWN		"/sbin/shutdown"
-#define _PATH_POWEROFF		"/sbin/poweroff"
+#define _PATH_SHUTDOWN		"@TERMUX_PREFIX@/bin/shutdown"
+#define _PATH_POWEROFF		"@TERMUX_PREFIX@/bin/poweroff"
+#define _PATH_VI		"@TERMUX_PREFIX@/bin/editor" // let the alternatives system decide
 
 #define _PATH_TERMCOLORS_DIRNAME "terminal-colors.d"
-#define _PATH_TERMCOLORS_DIR	"/etc/" _PATH_TERMCOLORS_DIRNAME
+#define _PATH_TERMCOLORS_DIR	"@TERMUX_PREFIX@/etc/" _PATH_TERMCOLORS_DIRNAME
 
 /* login paths */
-#define _PATH_PASSWD		"/etc/passwd"
-#define _PATH_GSHADOW		"/etc/gshadow"
-#define _PATH_GROUP		"/etc/group"
-#define _PATH_SHADOW_PASSWD	"/etc/shadow"
-#define _PATH_SHELLS		"/etc/shells"
+// Termux doesn't support multiuser environment.
+// Some Android versions support /etc/passwd and /etc/group but files
+// /etc/shadow and /etc/gshadow are not supported.
+#define _PATH_PASSWD		"/system/etc/passwd"
+#define _PATH_GSHADOW		"/system/etc/gshadow"
+#define _PATH_GROUP		"/system/etc/group"
+#define _PATH_SHADOW_PASSWD	"/system/etc/shadow"
+// Ignored in Termux.
+#define _PATH_SHELLS		"@TERMUX_PREFIX@/etc/shells"
 
 #ifndef _PATH_TMP
 # define _PATH_TMP		"/tmp/"
 #endif
 
+// btmp, (and utmp/wtmp) files are unsupported.
 #ifndef _PATH_BTMP
-# define _PATH_BTMP		"/var/log/btmp"
+# define _PATH_BTMP		"@TERMUX_PREFIX@/var/log/btmp"
 #endif
 
 #define _PATH_ISSUE_FILENAME	"issue"
 #define _PATH_ISSUE_DIRNAME	_PATH_ISSUE_FILENAME ".d"
 
-#define _PATH_ISSUE		"/etc/" _PATH_ISSUE_FILENAME
-#define _PATH_ISSUEDIR		"/etc/" _PATH_ISSUE_DIRNAME
+#define _PATH_ISSUE		"@TERMUX_PREFIX@/etc/" _PATH_ISSUE_FILENAME
+#define _PATH_ISSUEDIR		"@TERMUX_PREFIX@/etc/" _PATH_ISSUE_DIRNAME
 
-#define _PATH_OS_RELEASE_ETC	"/etc/os-release"
-#define _PATH_OS_RELEASE_USR	"/usr/lib/os-release"
+// os release definition is not available in Termux.
+#define _PATH_OS_RELEASE_ETC	"@TERMUX_PREFIX@/etc/os-release"
+#define _PATH_OS_RELEASE_USR	"@TERMUX_PREFIX@/lib/os-release"
 #define _PATH_NUMLOCK_ON	_PATH_RUNSTATEDIR "/numlock-on"
-#define _PATH_LOGINDEFS		"/etc/login.defs"
+// login configuration is unsupported.
+#define _PATH_LOGINDEFS		"@TERMUX_PREFIX@/etc/login.defs"
 
 #define _PATH_SD_UNITSLOAD	_PATH_RUNSTATEDIR "/systemd/systemd-units-load"
 
 /* misc paths */
-#define _PATH_WORDS             "/usr/share/dict/words"
-#define _PATH_WORDS_ALT         "/usr/share/dict/web2"
+#define _PATH_WORDS             "@TERMUX_PREFIX@/share/dict/words"
+#define _PATH_WORDS_ALT         "@TERMUX_PREFIX@/share/dict/web2"
 
 /* mount paths */
-#define _PATH_FILESYSTEMS	"/etc/filesystems"
+// Not available.
+#define _PATH_FILESYSTEMS	"@TERMUX_PREFIX@/etc/filesystems"
 #define _PATH_PROC		"/proc"
 #define _PATH_PROC_SWAPS	"/proc/swaps"
 #define _PATH_PROC_FILESYSTEMS	"/proc/filesystems"
@@ -132,7 +133,7 @@
 # ifdef MOUNTED					/* deprecated */
 #  define _PATH_MOUNTED		MOUNTED
 # else
-#  define _PATH_MOUNTED		"/etc/mtab"
+#  define _PATH_MOUNTED		"/proc/self/mounts"
 # endif
 #endif
 
@@ -140,7 +141,8 @@
 # ifdef MNTTAB					/* deprecated */
 #  define _PATH_MNTTAB		MNTTAB
 # else
-#  define _PATH_MNTTAB		"/etc/fstab"
+// Not available.
+#  define _PATH_MNTTAB		"@TERMUX_PREFIX@/etc/fstab"
 # endif
 #endif
 
@@ -155,22 +157,22 @@
 
 #define _PATH_DEV_MEM		"/dev/mem"
 
-#define _PATH_DEV_LOOP		"/dev/loop"
+#define _PATH_DEV_LOOP		"/dev/block/loop"
 #define _PATH_DEV_LOOPCTL	"/dev/loop-control"
 
 /* udev paths */
-#define _PATH_DEV_BYLABEL	"/dev/disk/by-label"
-#define _PATH_DEV_BYUUID	"/dev/disk/by-uuid"
-#define _PATH_DEV_BYID		"/dev/disk/by-id"
-#define _PATH_DEV_BYPATH	"/dev/disk/by-path"
-#define _PATH_DEV_BYPARTLABEL	"/dev/disk/by-partlabel"
-#define _PATH_DEV_BYPARTUUID	"/dev/disk/by-partuuid"
+#define _PATH_DEV_BYLABEL	"/dev/block/by-label"
+#define _PATH_DEV_BYUUID	"/dev/block/by-uuid"
+#define _PATH_DEV_BYID		"/dev/block/by-id"
+#define _PATH_DEV_BYPATH	"/dev/block/by-path"
+#define _PATH_DEV_BYPARTLABEL	"/dev/block/by-partlabel"
+#define _PATH_DEV_BYPARTUUID	"/dev/block/by-partuuid"
 
 /* hwclock paths */
 #ifdef CONFIG_ADJTIME_PATH
 # define _PATH_ADJTIME		CONFIG_ADJTIME_PATH
 #else
-# define _PATH_ADJTIME		"/etc/adjtime"
+# define _PATH_ADJTIME		"@TERMUX_PREFIX@/etc/adjtime"
 #endif
 
 #ifdef __ia64__
diff --git a/lib/exec_shell.c b/lib/exec_shell.c
index 96d3e95a8..46840a53e 100644
--- a/lib/exec_shell.c
+++ b/lib/exec_shell.c
@@ -28,7 +28,7 @@
 
 #include "exec_shell.h"
 
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
 
 void __attribute__((__noreturn__)) exec_shell(void)
 {
diff --git a/lib/loopdev.c b/lib/loopdev.c
index 2359bf781..056ac6e75 100644
--- a/lib/loopdev.c
+++ b/lib/loopdev.c
@@ -128,13 +128,13 @@ int loopcxt_set_device(struct loopdev_cxt *lc, const char *device)
 	/* set new */
 	if (device) {
 		if (*device != '/') {
-			const char *dir = _PATH_DEV;
+			const char *dir = _PATH_DEV "block/";
 
 			/* compose device name for /dev/loop<n> or /dev/loop/<n> */
 			if (lc->flags & LOOPDEV_FL_DEVSUBDIR) {
-				if (strlen(device) < 5)
+				if (strlen(device) < 11)
 					return -1;
-				device += 4;
+				device += 10;
 				dir = _PATH_DEV_LOOP "/";	/* _PATH_DEV uses trailing slash */
 			}
 			snprintf(lc->device, sizeof(lc->device), "%s%s",
diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h
index fa2379c4d..f11996748 100644
--- a/libblkid/src/blkidP.h
+++ b/libblkid/src/blkidP.h
@@ -308,7 +308,7 @@ struct blkid_struct_cache
 #define BLKID_BIC_FL_CHANGED	0x0004	/* Cache has changed from disk */
 
 /* config file */
-#define BLKID_CONFIG_FILE	"/etc/blkid.conf"
+#define BLKID_CONFIG_FILE	"@TERMUX_PREFIX@/etc/blkid.conf"
 
 /* cache file on systemds with /run */
 #define BLKID_RUNTIME_TOPDIR	"/run"
@@ -316,7 +316,7 @@ struct blkid_struct_cache
 #define BLKID_CACHE_FILE	BLKID_RUNTIME_DIR "/blkid.tab"
 
 /* old systems */
-#define BLKID_CACHE_FILE_OLD	"/etc/blkid.tab"
+#define BLKID_CACHE_FILE_OLD	"@TERMUX_PREFIX@/etc/blkid.tab"
 
 #define BLKID_ERR_IO	 5
 #define BLKID_ERR_SYSFS	 9
diff --git a/libblkid/src/topology/dm.c b/libblkid/src/topology/dm.c
index 7687e327a..6d510abaf 100644
--- a/libblkid/src/topology/dm.c
+++ b/libblkid/src/topology/dm.c
@@ -30,9 +30,8 @@ static int probe_dm_tp(blkid_probe pr,
 		const struct blkid_idmag *mag __attribute__((__unused__)))
 {
 	const char * const paths[] = {
-		"/usr/local/sbin/dmsetup",
-		"/usr/sbin/dmsetup",
-		"/sbin/dmsetup"
+		"@TERMUX_PREFIX@/bin/dmsetup",
+		"@TERMUX_PREFIX@/sbin/dmsetup"
 	};
 	int dmpipe[] = { -1, -1 }, stripes = 0, stripesize = 0;
 	const char *cmd = NULL;
diff --git a/libblkid/src/topology/lvm.c b/libblkid/src/topology/lvm.c
index f5c3d484b..80be642a1 100644
--- a/libblkid/src/topology/lvm.c
+++ b/libblkid/src/topology/lvm.c
@@ -36,9 +36,8 @@ static int probe_lvm_tp(blkid_probe pr,
 		const struct blkid_idmag *mag __attribute__((__unused__)))
 {
 	const char * const paths[] = {
-		"/usr/local/sbin/lvdisplay",
-		"/usr/sbin/lvdisplay",
-		"/sbin/lvdisplay"
+		"@TERMUX_PREFIX@/bin/lvdisplay",
+		"@TERMUX_PREFIX@/sbin/lvdisplay"
 	};
 	int lvpipe[] = { -1, -1 }, stripes = 0, stripesize = 0;
 	FILE *stream = NULL;
diff --git a/libmount/src/cache.c b/libmount/src/cache.c
index b7956346f..ffe3dc103 100644
--- a/libmount/src/cache.c
+++ b/libmount/src/cache.c
@@ -654,7 +654,7 @@ char *mnt_pretty_path(const char *path, struct libmnt_cache *cache)
 	/* users assume backing file name rather than /dev/loopN in
 	 * output if the device has been initialized by mount(8).
 	 */
-	if (strncmp(pretty, "/dev/loop", 9) == 0) {
+	if (strncmp(pretty, "/dev/block/loop", 15) == 0) {
 		struct loopdev_cxt lc;
 
 		if (loopcxt_init(&lc, 0) || loopcxt_set_device(&lc, pretty))
diff --git a/libmount/src/hook_loopdev.c b/libmount/src/hook_loopdev.c
index 444d69d6f..54ca0ebf3 100644
--- a/libmount/src/hook_loopdev.c
+++ b/libmount/src/hook_loopdev.c
@@ -105,7 +105,7 @@ is_mounted_same_loopfile(struct libmnt_context *cxt,
 
 		rc = 0;
 
-		if (strncmp(src, "/dev/loop", 9) == 0) {
+		if (strncmp(src, "/dev/block/loop", 15) == 0) {
 			rc = loopdev_is_used((char *) src, bf, offset, 0, LOOPDEV_FL_OFFSET);
 
 		} else if (opts && (flags & MNT_MS_LOOP) &&
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 4209d697a..fb0e59731 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -1948,7 +1948,7 @@ int __mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_f
 			int flags = 0;
 
 			if (!mnt_fs_get_srcpath(fs) ||
-			    !ul_startswith(mnt_fs_get_srcpath(fs), "/dev/loop"))
+			    !ul_startswith(mnt_fs_get_srcpath(fs), "/dev/block/loop"))
 				continue;	/* does not look like loopdev */
 
 			if (mnt_fs_get_option(fstab_fs, "offset", &val, &len) == 0) {
diff --git a/libuuid/src/uuidd.h b/libuuid/src/uuidd.h
index f76acc8b2..14b1c2c12 100644
--- a/libuuid/src/uuidd.h
+++ b/libuuid/src/uuidd.h
@@ -38,7 +38,7 @@
 #define UUIDD_DIR		_PATH_RUNSTATEDIR "/uuidd"
 #define UUIDD_SOCKET_PATH	UUIDD_DIR "/request"
 #define UUIDD_PIDFILE_PATH	UUIDD_DIR "/uuidd.pid"
-#define UUIDD_PATH		"/usr/sbin/uuidd"
+#define UUIDD_PATH		"@TERMUX_PREFIX@/bin/uuidd"
 
 #define UUIDD_OP_GETPID			0
 #define UUIDD_OP_GET_MAXOP		1
diff --git a/login-utils/su-common.c b/login-utils/su-common.c
index ae0621de3..57b01f77e 100644
--- a/login-utils/su-common.c
+++ b/login-utils/su-common.c
@@ -106,7 +106,7 @@ UL_DEBUG_DEFINE_MASKNAMES(su) = UL_DEBUG_EMPTY_MASKNAMES;
 #define is_pam_failure(_rc)	((_rc) != PAM_SUCCESS)
 
 /* The shell to run if none is given in the user's passwd entry.  */
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
 
 /* The user to become if none is specified.  */
 #define DEFAULT_USER "root"
diff --git a/login-utils/sulogin.c b/login-utils/sulogin.c
index aeaa3f11f..ba0e13d4b 100644
--- a/login-utils/sulogin.c
+++ b/login-utils/sulogin.c
@@ -893,7 +893,7 @@ static void sushell(struct passwd *pwd, struct console *con)
 		if (pwd->pw_shell[0])
 			su_shell = pwd->pw_shell;
 		else
-			su_shell = "/bin/sh";
+			su_shell = "@TERMUX_PREFIX@/bin/sh";
 	}
 	if ((p = strrchr(su_shell, '/')) == NULL)
 		p = su_shell;
@@ -942,9 +942,9 @@ static void sushell(struct passwd *pwd, struct console *con)
 	execl(su_shell, shell, (char *)NULL);
 	warn(_("failed to execute %s"), su_shell);
 
-	xsetenv("SHELL", "/bin/sh", 1);
-	execl("/bin/sh", profile ? "-sh" : "sh", (char *)NULL);
-	warn(_("failed to execute %s"), "/bin/sh");
+	xsetenv("SHELL", "@TERMUX_PREFIX@/bin/sh", 1);
+	execl("@TERMUX_PREFIX@/bin/sh", profile ? "-sh" : "sh", (char *)NULL);
+	warn(_("failed to execute %s"), "@TERMUX_PREFIX@/bin/sh");
 }
 
 #ifdef HAVE_LIBSELINUX
diff --git a/misc-utils/whereis.c b/misc-utils/whereis.c
index b575e57ae..40b2d34cc 100644
--- a/misc-utils/whereis.c
+++ b/misc-utils/whereis.c
@@ -101,84 +101,18 @@ struct wh_dirlist {
 };
 
 static const char *const bindirs[] = {
-	"/usr/bin",
-	"/usr/sbin",
-	"/bin",
-	"/sbin",
-#if defined(MULTIARCHTRIPLET)
-	"/lib/" MULTIARCHTRIPLET,
-	"/usr/lib/" MULTIARCHTRIPLET,
-	"/usr/local/lib/" MULTIARCHTRIPLET,
-#endif
-	"/usr/lib",
-	"/usr/lib32",
-	"/usr/lib64",
-	"/etc",
-	"/usr/etc",
-	"/lib",
-	"/lib32",
-	"/lib64",
-	"/usr/games",
-	"/usr/games/bin",
-	"/usr/games/lib",
-	"/usr/emacs/etc",
-	"/usr/lib/emacs/*/etc",
-	"/usr/TeX/bin",
-	"/usr/tex/bin",
-	"/usr/interviews/bin/LINUX",
-
-	"/usr/X11R6/bin",
-	"/usr/X386/bin",
-	"/usr/bin/X11",
-	"/usr/X11/bin",
-	"/usr/X11R5/bin",
-
-	"/usr/local/bin",
-	"/usr/local/sbin",
-	"/usr/local/etc",
-	"/usr/local/lib",
-	"/usr/local/games",
-	"/usr/local/games/bin",
-	"/usr/local/emacs/etc",
-	"/usr/local/TeX/bin",
-	"/usr/local/tex/bin",
-	"/usr/local/bin/X11",
-
-	"/usr/contrib",
-	"/usr/hosts",
-	"/usr/include",
-
-	"/usr/g++-include",
-
-	"/usr/ucb",
-	"/usr/old",
-	"/usr/new",
-	"/usr/local",
-	"/usr/libexec",
-	"/usr/share",
-
-	"/opt/*/bin",
+	"@TERMUX_PREFIX@/bin",
 	NULL
 };
 
 static const char *const mandirs[] = {
-	"/usr/man/*",
-	"/usr/share/man/*",
-	"/usr/X386/man/*",
-	"/usr/X11/man/*",
-	"/usr/TeX/man/*",
-	"/usr/interviews/man/mann",
-	"/usr/share/info",
+	"@TERMUX_PREFIX@/share/man/*",
+	"@TERMUX_PREFIX@/share/info",
 	NULL
 };
 
 static const char *const srcdirs[] = {
-	"/usr/src/*",
-	"/usr/src/lib/libc/*",
-	"/usr/src/lib/libc/net/*",
-	"/usr/src/ucb/pascal",
-	"/usr/src/ucb/pascal/utilities",
-	"/usr/src/undoc",
+	"@TERMUX_PREFIX@/src",
 	NULL
 };
 
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 4bcb5e69e..a61db097d 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -482,7 +482,7 @@ int main(int argc, char *argv[])
 		/* Don't use ifdef sparc here, we get "Unrecognized architecture"
 		 * error message later if necessary */
 		if (strcmp(arch, "sparc32bash") == 0) {
-			shell = "/bin/bash";
+			shell = "@TERMUX_PREFIX@/bin/bash";
 			shell_arg = "";
 			goto set_arch;
 		}
@@ -605,7 +605,7 @@ set_arch:
 		verify_arch_domain(doms, target, arch);
 
 	if (!argc) {
-		shell = "/bin/sh";
+		shell = "@TERMUX_PREFIX@/bin/sh";
 		shell_arg = "-sh";
 	}
 	if (verbose) {
diff --git a/sys-utils/setpriv.c b/sys-utils/setpriv.c
index 7242c333d..67b7b422d 100644
--- a/sys-utils/setpriv.c
+++ b/sys-utils/setpriv.c
@@ -56,7 +56,7 @@
 #define SETPRIV_EXIT_PRIVERR 127	/* how we exit when we fail to set privs */
 
 /* The shell to set SHELL env.variable if none is given in the user's passwd entry.  */
-#define DEFAULT_SHELL "/bin/sh"
+#define DEFAULT_SHELL "@TERMUX_PREFIX@/bin/sh"
 
 static gid_t get_group(const char *s, const char *err);
 
diff --git a/text-utils/more.c b/text-utils/more.c
index 13b1b0bb9..936abf11c 100644
--- a/text-utils/more.c
+++ b/text-utils/more.c
@@ -81,6 +81,7 @@
 # include <magic.h>
 #endif
 
+#include "pathnames.h"
 #include "strutils.h"
 #include "nls.h"
 #include "xalloc.h"
diff --git a/text-utils/pg.c b/text-utils/pg.c
index 3623f3f78..6c68dc16e 100644
--- a/text-utils/pg.c
+++ b/text-utils/pg.c
@@ -1371,7 +1371,7 @@ static void pgfile(FILE *f, const char *name)
 					{
 						const char *sh = getenv("SHELL");
 						if (!sh)
-							sh = "/bin/sh";
+							sh = "@TERMUX_PREFIX@/bin/sh";
 						if (!nobuf)
 							fclose(fbuf);
 						fclose(find);
