As a sysadmin I often use tools to access terminals on other systems. Most of the time this is ssh(1), sometimes it is telnet(1). Both have the command line flag -e. Using this flag I can change the default escape character ~ (a tilde) to something else. There is one tool in the base system which lacks this flag -e, and that is cu(1). I miss this flag in cu(1) so I tried to implement it by myself. That is the patch that resulted from this:

cu.diff

Index: command.c
===================================================================
RCS file: /cvs/src/usr.bin/cu/command.c,v
retrieving revision 1.16
diff -u -p -r1.16 command.c
--- command.c	10 Dec 2017 01:03:46 -0000	1.16
+++ command.c	11 Dec 2017 07:01:01 -0000
@@ -220,11 +220,32 @@ start_record(void)
 		cu_warnx("%s", file);
 }
 
+struct escape_help_text {
+	const char *cmd;
+	const char *text;
+};
+
+static struct escape_help_text esc_txt[] = {
+	{".", "drop connection and exit"},
+	{"#", "send break"},
+	{"$", "pipe local command to remote host"},
+	{">", "send file to remote host"},
+	{"C", "connect program to remote host"},
+	{"D", "de-assert DTR line briefly"},
+	{"R", "start recording to file"},
+	{"S", "set speed"},
+	{"X", "send file with XMODEM"},
+	{"?", "get this summary"},
+};
+
 void
 do_command(char c)
 {
+	int i;
+
 	if (restricted && strchr("CRX$>", c) != NULL) {
-		cu_warnx("~%c command is not allowed in restricted mode", c);
+		cu_warnx("%c%c command is not allowed in restricted mode", \
+		    escape, c);
 		return;
 	}
 
@@ -266,21 +287,15 @@ do_command(char c)
 		sleep(1);
 		ioctl(line_fd, TIOCCBRK, NULL);
 		break;
-	case '~':
-		bufferevent_write(line_ev, "~", 1);
-		break;
 	case '?':
-		printf("\r\n"
-		    "~#      send break\r\n"
-		    "~$      pipe local command to remote host\r\n"
-		    "~>      send file to remote host\r\n"
-		    "~C      connect program to remote host\r\n"
-		    "~D      de-assert DTR line briefly\r\n"
-		    "~R      start recording to file\r\n"
-		    "~S      set speed\r\n"
-		    "~X      send file with XMODEM\r\n"
-		    "~?      get this summary\r\n"
-		);
+		for (i = 0; i < sizeof(esc_txt) / sizeof(esc_txt[0]); i++) {
+			if (escape < 32)
+				printf("\r\n^%c", escape + 64);
+			else
+				printf("\r\n%c", escape);
+			printf("%s\t%s", esc_txt[i].cmd, esc_txt[i].text);
+		}
+		printf("\r\n");
 		break;
 	}
 }
Index: cu.1
===================================================================
RCS file: /cvs/src/usr.bin/cu/cu.1,v
retrieving revision 1.17
diff -u -p -r1.17 cu.1
--- cu.1	10 Dec 2017 07:34:38 -0000	1.17
+++ cu.1	11 Dec 2017 07:01:01 -0000
@@ -36,6 +36,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl dr
+.Op Fl e Ar char
 .Op Fl l Ar line
 .Op Fl s Ar speed | Fl Ar speed
 .Nm
@@ -55,6 +56,13 @@ The options are as follows:
 Specify that the line is directly connected and
 .Nm
 should not allow the driver to block waiting for a carrier to be detected.
+.It Fl e Ar char
+Sets the
+.Nm
+escape character to
+.Pa char .
+If not specified the escape character is the tilde
+.Pq Ql ~ .
 .It Fl l Ar line
 Specify the line to use.
 Either of the forms like
@@ -100,8 +108,8 @@ utility ignores other capabilities found
 .Pp
 Typed characters are normally transmitted directly to the remote
 machine (which does the echoing as well).
-A tilde
-.Pq Ql ~
+The escape character (by default:
+.Ql ~ )
 appearing as the first character of a line is an escape signal; the
 following are recognized:
 .Bl -tag -offset indent -width Fl
Index: cu.c
===================================================================
RCS file: /cvs/src/usr.bin/cu/cu.c,v
retrieving revision 1.26
diff -u -p -r1.26 cu.c
--- cu.c	10 Dec 2017 01:03:46 -0000	1.26
+++ cu.c	11 Dec 2017 07:01:01 -0000
@@ -41,6 +41,7 @@ FILE			*record_file;
 struct termios		 saved_tio;
 struct bufferevent	*input_ev;
 struct bufferevent	*output_ev;
+u_char			 escape = '~';
 int			 is_direct = -1;
 int			 restricted = 0;
 const char		*line_path = NULL;
@@ -53,7 +54,7 @@ struct event		 sighup_ev;
 enum {
 	STATE_NONE,
 	STATE_NEWLINE,
-	STATE_TILDE
+	STATE_ESCAPE
 } last_state = STATE_NEWLINE;
 
 __dead void	usage(void);
@@ -67,7 +68,7 @@ void		try_remote(const char *, const cha
 __dead void
 usage(void)
 {
-	fprintf(stderr, "usage: %s [-dr] [-l line] [-s speed | -speed]\n",
+	fprintf(stderr, "usage: %s [-dr] [-e char] [-l line] [-s speed | -speed]\n",
 	    __progname);
 	fprintf(stderr, "       %s [host]\n", __progname);
 	exit(1);
@@ -101,11 +102,21 @@ main(int argc, char **argv)
 			errx(1, "speed asprintf");
 	}
 
-	while ((opt = getopt(argc, argv, "drl:s:")) != -1) {
+	while ((opt = getopt(argc, argv, "dre:l:s:")) != -1) {
 		switch (opt) {
 		case 'd':
 			is_direct = 1;
 			break;
+		case 'e':
+			if (optarg[0] == '^' && optarg[2] == 0 &&
+			    (u_char) optarg[1] >= 64 &&
+			    (u_char) optarg[1] < 128)
+				escape = (u_char) optarg[1] & 31;
+			else if (strlen(optarg) == 1)
+				escape = (u_char) optarg[0];
+			else
+				errx(1, "bad escape character '%s'", optarg);
+			break;
 		case 'r':
 			if (pledge("stdio rpath wpath tty", NULL) == -1)
 				err(1, "pledge");
@@ -308,15 +319,18 @@ stream_read(struct bufferevent *bufev, v
 				last_state = STATE_NEWLINE;
 			break;
 		case STATE_NEWLINE:
-			if (state_change && *ptr == '~') {
-				last_state = STATE_TILDE;
+			if (state_change && *ptr == escape) {
+				last_state = STATE_ESCAPE;
 				continue;
 			}
 			if (*ptr != '\r')
 				last_state = STATE_NONE;
 			break;
-		case STATE_TILDE:
-			do_command(*ptr);
+		case STATE_ESCAPE:
+			if (*ptr == escape)
+				bufferevent_write(line_ev, ptr, 1);
+			else
+				do_command(*ptr);
 			last_state = STATE_NEWLINE;
 			continue;
 		}
Index: cu.h
===================================================================
RCS file: /cvs/src/usr.bin/cu/cu.h,v
retrieving revision 1.8
diff -u -p -r1.8 cu.h
--- cu.h	10 Dec 2017 01:03:46 -0000	1.8
+++ cu.h	11 Dec 2017 07:01:01 -0000
@@ -26,6 +26,7 @@ void				 do_command(char);
 extern int			 restricted;
 extern FILE			*record_file;
 extern struct termios		 saved_tio;
+extern u_char			 escape;
 extern int			 line_fd;
 extern struct bufferevent	*line_ev;
 void				 set_blocking(int, int);

You can apply this patch against a current source tree and install cu(1) with these commands:

$ cd /usr/src
$ patch < ~/cu.diff
$ cd usr.bin/cu
$ make
$ doas make install