Misc
Find count of files in current directory on linux - find . -type f | wc -l
lwp-request -sed http://localhost:8080/xyz/control/main
wget -q -O- http://www.xyz.com
wget --spider http://www.xyz.com
Find directory size - du -hs /path/to/directory
Find count of files in current directory on linux - find . -type f | wc -l
Import a sql file
svn up -r1123
| Starting vi | |
| Command | Meaning |
| vi filename | Open or create a file |
| vi | Open a new file to be named later |
| vi –r filename | Recover a crashed file |
| view filename | Open a file as read-only |
| Three Modes of operation in vi | |
| 1 | Command mode: Allows positioning and editing commands to perform functions. Entered via Esc, from entry mode, or Ret from Last-line mode. |
| 2 | Entry mode: Allows you to enter text. Entered via typing; A i I o O c C s S or R from command mode. |
| 3 | Last-line mode: Initiated from command mode by entering advanced editing commands like :, /, ?, !. |
| Input Commands | Deleting Text | ||
| Command | Meaning | Command | Meaning |
| a | Append text after the cursor | x or dl | Delete character at the cursor |
| A | Append text at the end of the line | X or dh | Delete character to the left of the cursor |
| i | Insert text before the cursor | dw | Delete word (or part of word to left of cursor) |
| I | Insert text at the beginning of the line | #dw | Delete # of words |
| o | Open a new line below the cursor | dd | Delete line containing the cursor |
| O | Open a new line above the cursor | #dd | Delete # of lines |
| Positioning Commands | D or d$ | Delete line to left of cursor (from cursor position to the end of the line) | |
| Command | Meaning | dG | Delete to the end of the file |
| h, Left Arrow, or Back Space | Move left one character | d1G | Delete from beginning of file to cursor |
| j or Down Arrow | Move down one line | :#1,#2d | Delete lines #1 through #2 |
| k or Up Arrow | Move up one line | Undoing Repeating and Changing Text | |
| l, Right Arrow or Spacebar | Move left (forward) one character | Command | Meaning |
| 0 | Move to beginning of current line | cw | Change word (or part of word) at cursor location to the end of the word |
| $ | Move to end of current line | #cw | Change # number of words |
| w | Move forward one word (including punctuation) | c#b | Change backwards # of words |
| W | Move forward one word (past punctuation) | cc or S | Replace entire current line |
| b | Move back one word (including punctuation) | C or c$ | Change from cursor to end of line |
| B | Move back one word (past punctuation) | c0 | Change from cursor to beginning of line |
| e | Move to end of current word | s | Substitute string for character(s) |
| E | Move to end of word (past punctuation) | R | Overwrite or replace characters on line |
| ( | Move to beginning of sentence | r | Replace character at cursor with one other character |
| ) | Move to end of sentence | i (Return) | Break line |
| { | Move to beginning of paragraph | J | Join current line and line below |
| } | Move to end of paragraph | xp | Transpose character at cursor and character to the left |
| ]] | Move to next section/function | ~ | Change case of letter at cursor |
| [[ | Move to previous section/function | u | Undo previous command (only goes back one level.) |
| % | Find matching ( ) or { } | U | Undo all changes to current line |
| - | Move up to beginning of previous line | :u | Undo previous last-line command |
| Return | Move down to beginning of next line | Copying and Pasting Text | |
| H | Move to top of screen | Command | Meaning |
| M | Move to middle of screen | yy or Y | Yank a copy of line |
| L | Move to bottom of screen | p | Put yanked or deleted line below current line |
| G | Go to last line of file | P | Put yanked or deleted line above current line |
| #G | Go to # line of file | :#1,#2 co #3 | Copy lines #1 through #2 and put after line #3 |
| :# | Go to line # | :#1,#2 m #3 | Move lines #1 through #2 to line #3 |
| CTRL-f | Page forward one screen | Saving and Quitting | |
| CTRL-d | Scroll down one-half screen | Command | Meaning |
| CTRL-b | Page back one screen | :w | Save changes |
| CTRL-u | Scroll up one-half screen | :w new_filename | Write buffer to new filename |
| CTRL-E | Scroll window down one line | :wq or ZZ | Save changes and quit vi |
| CTRL-Y | Scroll window up one line | :q! | Quit without saving changes. ('!' bang forces the system to perform action) |
| Setting Options | Reading Files and Commands | ||
| Command | Meaning | Command | Meaning |
| :set nu | Show line numbers | :r filename | Insert (read) file at line after cursor |
| :set nonu | Hide line numbers | : # r filename | Insert file after line # |
| :set ic | Searches should ignore case | :r !command | Insert output from command after current line |
| :set noic | Searches should be case-sensitive | :!command | Run command from subshell |
| :set list | Display invisible characters such as Tab and end-of-line | :sh | Create subshell. (Exit returns to vi) |
| :set nolist | Turn off the display of invisile characters | Searching and Replacing Text | |
| :set showmode | Display current mode of operation | Command | Meaning |
| :set noshowmode | Turn off mode display | /string | Search forward for string |
| :set lisp | Inserts indents in appropriate lisp format | ?string | Search backward for string |
| :set nolisp | Turn off lisp formatting | n | Find next occurrence of string |
| :set ai | Insert mode will indent each line equal to the line above | N | Find previous occurrence of string |
| :set noai | Turns off autoindent | :%s/old/new/ | Search and replace first occurrence of old with new |
| :set all | Displays list of all available options | :%s/old/new/g | Search and replace all occurrences of old with new |
top - display top CPU processes
Scp is a utility which allows files to be copied between machines. Scp is an updated version of an older utility named Rcp. It works the same, except that information (including the password used to log in) is encrypted. Also, if you have set up your .shosts file to allow you to ssh between machines without using a password as described in help on setting up your .shosts file, you will be able to scp files between machines without entering your password.
The general form of the command is:
% scp source-specification destination-specification
where source-specification indicates which file or directory is to be copied, and destination-specification indicates where the copied material is to be placed.
Either the source or the destination may be on the remote machine; i.e., you may copy files or directories into the account on the remote system OR copy them from the account on the remote system into the account you are logged into.
Example:
% scp myfile xyz@sdcc7:myfileTo copy a directory, use the -r (recursive) option. Example:
% scp -r mydir xyz@sdcc7:mydir
The format for the remote specification (source or destination) is:
user@machine:filename
where filename is the name (path) of the file or directory relative to the home (login) directory on the remote system.
The format for file specification on the local system is just:
filename
where fname is the name (path) relative to the current working directory on that system.
Just like the cp command, scp will overwrite an existing destination file. In addition, if the destination is an existing directory, the copied material will be placed beneath the directory.
% scp letter abc@sdcc3:application
% scp xyz@sdcc7:foo bar
% scp comix/garfield abc@sdcc3:stuff/fatcat
% scp xyz@sdcc7:comix/garfield stuff
% scp -r Section xyz@sdcc7:Chapter
% cd
% cd ..
% scp -r abc ir123@iacs5:abc
For more information about the scp (secure copy) command, check the on-line manual page for scp:
% man scp
You can find more keyboard shortcuts by going to Window - Preferences - General - Keys
We can see the complete list of shortcuts here - http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_(3.0).pdf