Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Collation of related Linux commands commonly used in Java development

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Java development commonly used when sorting out the relevant Linux commands", the article explained the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in-depth, together to study and learn "Java development of commonly used Linux commands collation" bar!

1. Find a file

The code is as follows:

Find /-name filename.txt

Look for the filename.txt file in the / directory by name.

The code is as follows:

Find. -name "* .xml"

Recursively find all xml files

The code is as follows:

Find. -name "* .xml" | xargs grep "hello world"

Recursively find all xml files that contain hello world in their contents

The code is as follows:

Grep-H 'spring' * .xml

Find all xml files that contain spring

The code is as follows:

Find. /-size 0 | xargs rm-f &

Delete files with zero file size

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 lines that contain test in all files that begin with d.

The code is as follows:

Grep 'test' aa bb cc

Displays the lines that match the test in the aa,bb,cc file.

The code is as follows:

Grep'[a Murz]\ {5\}'aa

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

two。 Check whether a program is running

The code is as follows:

Ps-ef | grep tomcat

View all processes related to tomcat

3. Terminating thread

The code is as follows:

Kill-9 19979

Terminate a process with thread number 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 a file

The code is as follows:

Cp source dest

Copy a file

The code is as follows:

Cp-r sourceFolder targetFolder

Recursively copy the entire folder

The code is as follows:

Scp sourecFile romoteUserName@remoteIp:remoteAddr

Remote copy

7. Create a directory

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 delete everything in the directory

9. Move Fil

The code is as follows:

Mv / temp/movefile / targetFolder

10. Rename

The code is as follows:

Mv oldNameFile newNameFile

11. Switch users

The code is as follows:

Su-username

twelve。 Modify file permissions

The code is as follows:

Chmod 777 file.java file.java

Permissions-rwxrwxrwx,r for read, w for write, x for executable

13. Compressed file

The code is as follows:

Tar-czf test.tar.gz / test1 / test2

14. List the compressed files

The code is as follows:

Tar-tzf test.tar.gz

15. Extract the file

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 10 example.txt

17. View the last 10 lines of the file

The code is as follows:

Tail-n 10 example.txt

18. View log type files

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 (configurable).

19. Execute commands using the Super Admin identity

The code is as follows:

Sudo rm a.txt

Delete files using the administrator identity

20. View port occupancy

The code is as follows:

Netstat-tln | grep 8080

View the usage of port 8080

21. Check which program the port belongs to

The code is as follows:

Lsof-I: 8080

twenty-two。 View the process

The code is as follows:

Ps aux | grep java

View java processes

The code is as follows:

Ps aux

View all processes

23. List the contents of the directory in a tree view

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

twenty-six。 Remote login

The code is as follows:

Ssh userName@ip

twenty-seven。 Print information

The code is as follows:

Echo $JAVA_HOME

Print the value of the java home environment variable

Thank you for your reading, the above is the "Java development commonly used when sorting out the relevant Linux commands" content, after the study of this article, I believe that you are commonly used in Java development of the relevant Linux commands collation of this problem have a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report