Command Editing in tcsh

tcsh lets you interactively browse up and down through your history list, selecting and editing commands before executing them.

Use CTRL-P and CTRL-N (or up arrow and down arrow) to move up and down through your history list. Each recalled command is displayed on the current command line. To execute the command, hit RETURN. To cancel it, hit CTRL-C.

To edit commands, tcsh provides a command line editor that uses emacs-like or vi-like key bindings. Select the appropriate set using bindkey -e or bindkey -v. Some of the most useful editing commands are shown in the rest of this section. (Use bindkey with no arguments to see all your key bindings.)

emacs Mode Editing Commands

In emacs mode, characters are inserted into the command line unless they are editing commands. You can move the cursor or delete characters using the commands shown below.

Table B-1. Cursor motion commands

Command

Description

CTRL-B

Move cursor back (left) one character

CTRL-F

Move cursor forward (right) one character

ESC b

Move cursor back one word

ESC f

Move cursor forward one word

CTRL-A

Move cursor to beginning of line

CTRL-E

Move cursor to end of line

Table B-2. Text deletion commands

Command

Description

DEL or CTRL-H

Delete character to left of cursor

CTRL-D

Delete character under cursor

ESC d

Delete word

ESC DEL or ESC CTRL-H

Delete word backward

CTRL-K

Delete from cursor to end of line

CTRL-U

Delete entire line

Preceding a command with ESC n repeats the command n times.

To search up through your history list

Get Using csh & tcsh now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.