Archive for January, 2009

Bash Keyboard Shortcuts

In the past I have spent so much time using the mouse to navigate through directories and have largely avoided using the bash because I never really knew keyboard shortcuts that are used in bash. I have found myself to be much more productive when I use bash commands rather than navigating with my mouse. Here are a list of bash keyboard shortcuts that I find very useful. Some I use more than others, but this list is a good reference of the most common shortucts, taken from Ubuntu Pocket Guide and Reference . Even though they are listed as Ubuntu shortcuts, they are essentially the same for most operating systems based on the Linux kernel.

Key Combination Description
Up/down cursor key Scroll through command history
Ctrl+left/right cursor key Move cursor from word to word
Tab Autocomplete command or filename/path
Ctrl+A Move to beginning of line
Ctrl+E Move to end of line
Ctrl+W/Alt+Backspace Delete word behind cursor
Alt+D Delete word in front of cursor
Ctrl+U Delete to beginning of line
Ctrl+K Delete to end of line
Ctrl+Y Restore text you’ve deleted
Ctrl+L Clear screen (actually, this simply moves the prompt to the top of the screen; existing commands are still visible if the terminal window is scrolled)
Ctrl+C Quit current program
Ctrl+Z Switch current program to background
Ctrl+R Search through command history
Ctrl+D Logout (technically, terminate input)
Ctrl+T Swap the two characters behind cursor

January 29, 2009 at 5:38 pm

Using SCP from the command line

scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit]
[-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 …
[[user@]host2:]file2

Common options:

Options

-P   Specifies the port on which to connect to on the remote host.
-q   Quiet mode: Do not display the progress bar and warning and other diagnostic messages.
-r    Recursively copy entire directories.
-v   Prints debugging messages about their progress

Examples

To copy a local file to a remote host:
scp foo.txt myusername@host.server.com:/home/myusername/

To copy a directory from a remote host to the current directory in your machine.
scp -r myusername@host.server.com:myfiles/ .

January 20, 2009 at 7:42 am


Calendar

January 2009
M T W T F S S
    Feb »
 1234
567891011
12131415161718
19202122232425
262728293031  

Posts by Month

Posts by Category


Follow

Get every new post delivered to your Inbox.