Linux Utility command Line

Source: Internet
Author: User
Tags create directory

For Linux commands, I have a gradual process in the learning and use process. Suitable for small white learning to use quickly. Laugh

Jump directory: cd + path for example: Cd/home/workspace

View a file, commonly used to view the log: Tail-f + file name

For example tail-300f Server.xml see the last 300 rows

You can also use more + file names such as more server.xml from the first line of the file to look down

View disk Memory: Df-h or df-k This general memory is full and will be used to view space usage.

Start Kill service:

Cd/java/tomcat
#bin目录下执行
SH startup.sh #启动tomcat
SH shutdown.sh #停止tomcat
Tail-f Logs/catalina.out #看tomcat的控制台输出 (here my log file is Catalina.out)
#看是否已经有tomcat在运行了
Ps-ef |grep Tomcat or Ps-ef|grep Java
Kill process: kill-9 PID
Then restart: SH startup.sh
Modify a file (typically we modify the configuration file under Tomact):

VI aa.txt/vi BB Create aa.txt File/create BB file (and can edit content) press ESC to exit Input: Q (do not save exit) or: Wq (save exit) can be appended with an exclamation point (enforced)
VI will have a hint that e can be changed
Then press I
The following insert can be edited and finished editing input: wq! save exit
Remember to change the input method into English or Chinese input does not respond

and view historical commands: History
Clear the screen: clear
CTRL + C return

Copy a file to a path:
Cp/users/admin/ideaprojects/p2p-my/www.huarenyl.cn/p2p-wap/www.douniu178.com target/h5.war/library/ apache-tomcat-8.5.28/webapps/
CP source file path destination path
The above two paths can either be absolute or relative.
For example, I want to copy the passwd file from the ETC directory to the root directory.
CP/ETC/PASSWD/

Upload a file or folder to a Linux remote server:
Input command SCP local file address [email protected] Server IP: Server side path
Then enter the password and upload the progress.


Copy file upload to Linux server: SCP www.mhylpt.com//Users/admin/IdeaProjects/p2p-my/p2p-api/target/ROOT.war [Email protected]:/ home/workspace/api-tomcat/webapps/

Copy folder to Linux server: scp-r/users/admin/ideaprojects/miaoyinlc_h5/[Email Protected]:/home/workspace/wap-tomcat/webapps /root/

Delete all files in directory and directory: Delete files under directories and directories RM-RF Dir1
Rm-f file1 Delete a file called ' File1 '
Note: RM-RF must be careful to carry out, try not to carry out. Execution also depends on how to execute!!!!!!!!

==================================================================
This fairy experiment: Originally is to edit a file content, in order to do a demo on the creation, deletion, editing, view files are understood under.
Summarize:
mkdir Demo Create Directory
Rm-r Delete files in directories and directories
VI aa.txt/vi BB Create aa.txt File/create BB file (and can edit content) press ESC to exit Input: Q (do not save exit) or: Wq (save exit) can be appended with an exclamation point (enforced)
VI will have a hint that e can be changed
Then press I
The following insert can be edited and finished editing input: wq! save exit
Remember to change the input method into English or Chinese input does not respond
The shift plus insert is meant to be pasted, but the cursor must not be behind the letter on the last letter, or the last one is a space by default.
Cat Aa.txt/cat BB View files with less content
More Aa.txt/more BB View the contents of the file more space is the next page,
head-3 aa.txt www.dashuju178.com/head-3 BB

Find File:
-name based on file name
Eg: Find the ax37 file in the current directory. -name "*37"-print
-perm Based on permissions
Eg: Find the rw-rw-r--file in the current directory. -perm 664-print
-prune Ignore (a file name)
Eg: find the current directory name is not a file1 file for find. -name "File1"-prune-o-print


I am here to introduce a few very simple commands, the fairy has just come into contact with Linux most commonly used. Cheer Up ~

Linux Utility command Line

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.