Linux/mac OS Personal common terminal skill finishing

Source: Internet
Author: User
Tags clear screen grep regular expression openssh server



Just started to contact Linux Some do not adapt, took a lot of detours, has not systematically studied Linux applications, the basic is fragmented Google out of the knowledge, here do a collation:





Vi/vim Basic Operation:


Just started to contact with Linux, do not understand VI ate a lot of losses. In the command line state, once you open the text with VI, you can only exit by restarting.






Vi/vim is divided into three modes: instruction mode, edit mode, and select mode. Input is only possible in edit mode (not absolute).



The default is "instruction mode", this mode only supports VI/VIM instructions, when tapping the keyboard will only drip sound. I don't know how many people have been dizzy by this way (dizzy not dizzy by you, anyway I was dizzy.) If you're not dizzy, congratulations, that's a miracle.



Ok~ about the Vi/vim operation is not intended to be too much to organize here, to meet the basic operation of the line:






1. Press i in the default "instruction mode" to enter edit mode



2. Press ESC to return to instruction mode in non-instruction mode



3. Under "instruction Mode", enter:



: W Save current file



: Q Exit Edit if file is required for save in mandatory mode



: q! forced exit does not save changes



: Wq combo instruction, save and exit



4. Move under "instruction mode":



H Left



J Down



K On



L Right






#Page turning

Shift + f (front) Next


Shift + B (back) previous page


About Vi / vim finishing up here, know that these basic can avoid I just touch Linux when those silly x problem

About vim need more?


Concise VIM Training Guide-http: //coolshell.cn/articles/5426.html

Online tutorial + web version vim-http: //www.openvim.com/index.html

Terminal Basic Instructions

#Permission related



sudo to elevate the current operation permissions



passwd [Username] Modify user password, generally used to activate the root user (administrator)



Chown [Target][user] Modifying the owner of the target set



chmod 755 [command] to increase execution permissions for a specified file



#chown/chmod, these two instructions didn't dig in.






#view/Help



Man[command] View instructions for help, generally use vim to open the TXT help file, press Q to exit (Focus)



Cat [file name] outputs the contents of the specified file



which [command] view the location of the instruction: which Ruby can check the environment






#Basic file operations



ls-a [path] View all files in the current directory, including hidden files



Ls-l[path] View complete information about the file, including owner, read and Write permissions



RM-RF [path] Delete folder



MV [Source path] [target] Move File/rename



CP [Source path] [target] Copy file





Utilities in Terminal


Tail-f$catalina_home/logs/catalina.out Viewing the Tomcat log



Tree-l 3. Viewing the table of contents in a tree structure,-l setting the viewing depth



grep Regular Expression tool, which can be used to filter results



ls-a | grep. BA can find hidden files containing BA, sometimes used to find. bash_profile files



SVN St | grep ^? View files that are not added in the current library



Ping-c 3 10.2.1.18ping 3 times Specify the target, and the unspecified number of times will always ping (this is not the same as Windows)


Terminal Operation Tips


Ctrl + A cursor moves to the beginning of the line



Ctrl + E ... Move to end of line



Double tab to list alternate commands/optional files






Ctrl + C forces the current operation to be rolled out









Under Mac OS



Command + K Clear Screen



Command + T new label



Command + {}x left/right Toggle tab



Mac OS uses iterm instead of bring-your-own terminal





3 ways to make ~/.bash_profile effective immediately


1 ... bash_profile



2.source. Bash_profile (using this method)



3. EXEC Bash--login








Process actions:


ps-a | grep [process name Regex]: Review the development process,



e.g:ps-a | grep Eclipse View Eclipse process






Kill [PID]: Force kill to make progress






sudo lsof-i-P | grep 9092



Very useful for viewing the PID of a specified port






UPDATE[2014-03-17]:






lsof-i:8080



This is faster.





SSH operation:


SSH [email protected] #The server needs to set up an OpenSSH server






SCP./lib/*.jar [Email protected]:jeespace/biandan/war/web-inf/lib #向SSH Server remote Copy file





Text manipulation:





Replace the <title> of all JSP pages under the war;:






Linux/mac OS Personal common terminal skill finishing


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.