Unix Reference

Up/Down arrow keys (redo a previous command)

Video

A nice shell feature is going backwards through your command history by using the up and down arrow keys.

The up arrow key goes back to the last command, and keeps traversing backwards through your history until you get to the command you want. You can use the down arrow key to go foward in your history if you have already used the up arrow key to go back some commands.

Example:

$ cd cs107/assignments/assign0
$ ls
hello  hello.c  hello.c~  innerFolder  readme.txt  samples
$ cat hello.c
#include<stdio.h>
#include<stdlib.h>

int main() {
    printf("Hello, World!\n");
    return 0;
}

(type up arrow twice)
$ ls
hello  hello.c  hello.c~  innerFolder  readme.txt  samples
$

Back to contents