Related Linux command collation frequently used in Java development

Source: Internet
Author: User

1. Find Files

The code is as follows:
Find/-name filename.txt

filename.txt files by name lookup/directory.

The code is as follows:

Find. -name "*.xml"

Recursively find all the XML files

The code is as follows:

Find. -name "*.xml" |xargs grep "Hello World"

Recursively find the XML file containing Hello World in all file contents

The code is as follows:

Grep-h ' Spring ' *.xml

Find some XML files that contain spring

The code is as follows:

Find./-size 0 | Xargs Rm-f &

Delete a file with a file size of zero

The code is as follows:

Ls-l | grep '. Jar '

Find all jar files in the current directory

The code is as follows:

grep ' Test ' d*

Displays the rows that contain test in all files that start with D.

The code is as follows:

grep ' Test ' AA bb cc

Displays the row that matches test in the aa,bb,cc file.

The code is as follows:

grep ' [a-z]\{5\} ' AA

Displays all the lines that contain at least 5 consecutive lowercase characters for each string.

2. See if a program is running

The code is as follows:
Ps-ef|grep Tomcat

View all processes related to Tomcat

3. Terminate the thread

The code is as follows:
Kill-9 19979

Terminating the process of thread number bit 19979

4. View files, including hidden files

The code is as follows:
Ls-al

5. Current working directory

The code is as follows:
Pwd

6. Copy files

The code is as follows:
CP Source Dest

Copying files

The code is as follows:

Cp-r Sourcefolder TargetFolder

Recursively copy an entire folder

The code is as follows:

SCP Sourecfile romoteusername@remoteip:remoteaddr

Remote Copy

7. Create a table of contents

The code is as follows:
mkdir NewFolder

8. Delete Directory

The code is as follows:
RmDir Deleteemptyfolder

Delete Empty Directory

The code is as follows:

RM-RF DeleteFile

Recursively deletes all content in a directory

9. Moving files

The code is as follows:
Mv/temp/movefile/targetfolder

10. Renaming

The code is as follows:
MV Oldnamefile Newnamefile

11. Switch Users

The code is as follows:
Su-username

12. Modify File Permissions

The code is as follows:
chmod 777 File.java File.java

The permissions-rwxrwxrwx,r the Read, W, and X represents the executable

13. Compressed Files

The code is as follows:
Tar-czf Test.tar.gz/test1/test2

14. List Compressed Files

The code is as follows:
Tar-tzf test.tar.gz

15. Extract Files

The code is as follows:
Tar-xvzf test.tar.gz

16. View the first 10 lines of the file

The code is as follows:
Head-n Example.txt

17. View the end of the file 10 lines

The code is as follows:
Tail-n Example.txt

18. View Log type File

The code is as follows:
Tail-f Exmaple.log

This command automatically displays the new content, and the screen displays only 10 lines of content (can be set).

19. Execute command using Super admin status

The code is as follows:
sudo rm a.txt

To delete a file by using administrator identity

20. View Port occupancy

The code is as follows:
Netstat-tln | grep 8080

View usage of port 8080

21. See which program the port belongs to

The code is as follows:
Lsof-i: 8080

22. View Process

The code is as follows:
PS Aux|grep Java

View Java processes

The code is as follows:
PS aux

View All Processes

23. Listing the contents of a directory in a tree chart

The code is as follows:
Tree A

24. File download

The code is as follows:
wget http://file.tgz
Curl Http://file.tgz

25. Network detection

The code is as follows:
Ping www.just-ping.com

26. Remote Logins

The code is as follows:
SSH Username@ip

27. Print information

The code is as follows:
Echo $JAVA _home

Print the value of a Java home environment variable

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.