Linux logo
top bar left/images/caspian/top-banner.jpgtop bar right
menu top
 
menu bottom
 
 
  Useful things to know about Bash

SH man page (very cool)
Another cool Bash Manual

Bash Editing Keystrokes

Keystroke(s)

Function

Up

Move back one command in the history list.

Down

Move forward one command in the history list.

Left

Move back one character.

Right

Move forward one character.

Esc f

Move forward one word.

Esc b

Move back one word.

Ctrl-A

Move to beginning of line.

Ctrl-E

Move to end of line.

Ctrl-D

Delete current character.

Backspace

Delete previous character.

Esc d

Delete current word.

Ctrl-U

Delete from beginning of line.

Esc k

Delete to end of line.

Ctrl-Y

Retrieve last item deleted.

Esc .

Insert last word of previous command.

Ctrl-L

Clear the screen, placing the current line at the top of the screen.

Tab

Attempt to complete the current word, interpreting it as a filename, username, variable name, hostname, or command as determined by the context.

Esc ?

List the possible completions.

Bash Control Keystrokes

Keystroke

Function

Ctrl-C

Sends an interrupt signal to the currently executing command, which generally responds by terminating itself.

Ctrl-D

Sends an end of file to the currently executing command. Use this keystroke to terminate console input.

Ctrl-Z

Suspends the currently executing program. (see commands 'fg' and 'jobs')

Filename Metacharacters

Metacharacter

Meaning

*

Matches a string of zero or more characters

?

Matches exactly one character

[ abc ...]

Matches any of the characters specified

[ a - z ]

Matches any character in the specified range

[! abc ...]

Matches any character other than those specified

[! a - z ]

Matches any character not in the specified range

~

The home directory of the current user

~ userid

The home directory of the specified user

~+

The current working directory

~-

The previous working directory


Input/Output Redirectors

Redirector

Function

> file

Redirects standard output stream to specified file

2> file

Redirects standard error stream to specified file

>> file

Redirects standard output stream to specified file, appending output to the file if the file already exists

2>> file

Redirects standard error stream to specified file, appending output to the file if the file already exists

&> file

Redirects standard output and error streams to the specified file

< file

Redirects standard input stream to the specified file

<< text

Reads standard input until a line matching text is found, at which point end of file is posted

cmd1 | cmd2

Takes the standard input of cmd2 from the standard output of cmd1 (also known as the pipe redirector)



 
  
bottom left bottom right