Linux commands that Java programmers must master

Source: Internet
Author: User

As a Java developer, some common Linux commands must be mastered. Linux (Unix) or Mac systems are not used in the development process, and Linux commands need to be mastered. Because many servers are Linux systems. Therefore, to interact with the server machine, it is necessary to pass the shell command.

This article does not explain all the commands in detail, only the common usage and explanations. Use Help to view Help or learn directly from Google search.

1. Find Files

Find/-name filename.txt the filename.txt file under the name lookup/directory.

Find. -name "*.xml" recursively finds all XML files

Find. -name "*.xml" |xargs grep "Hello World" recursively finds XML file containing Hello World in all file contents

Grep-h ' Spring ' *.xml find so some XML file that contains spring

Find./-size 0 | Xargs Rm-f & Delete files with a file size of zero

Ls-l | grep ' jar ' finds all jar files in the current directory

grep ' test ' d* shows all lines that contain test in a file that begins with D.

grep ' Test ' AA bb cc shows the line matching test in the aa,bb,cc file.

grep ' [a-z]/{5/} ' AA displays all rows containing a string of at least 5 consecutive lowercase characters per string.

2. See if a program is running

Ps–ef|grep Tomcat View all processes related to Tomcat

3. Terminating a thread

Kill-9 19979 terminating thread number bit 19979 thread

4. View files, including hidden files

Ls-al

5. Current working directory

Pwd

6. Copying files

CP Sourcefolder TargetFolder

SCP sourecfile [email protected]:remoteaddr remote Copy

7. Create a Directory

mkdir NewFolder

8. Deleting a directory

RmDir deleteemptyfolder Delete Empty directory rm-rf DeleteFile recursively delete all contents in directory

9. Move files

Mv/temp/movefile/targetfolder

10. Re-order

MV Oldnamefile Newnamefile

11. Switch Users

Su-username

12. Modify File Permissions

chmod 777 File.java//file.java's permission-rwxrwxrwx,r means read, w represents write, X is executable

13. Compressing files

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

14. List Compressed Files

Tar-tzf test.tar.gz

15. Extracting Files

Tar-xvzf test.tar.gz

16. View file Header 10 lines

Head-n Example.txt

17. View the end of the file 10 lines

Tail-n Example.txt

18. View the log type file

Tail-f exmaple.log//This command automatically displays what's new, and the screen displays only 10 lines of content (can be set).

19. Execute commands with Super Administrator status

sudo rm a.txt Delete files with administrator status

20. View Port Usage

Netstat-tln | grep 8080 viewing usage of port 8080

21. See which program the port belongs to

Lsof-i: 8080

22. View the process

PS aux|grep Java View Java process

PS aux view All processes

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

Tree A

Ps:mac using the tree command

24. File download

wget http://file.tgz
Install wget command under Mac

Curl Http://file.tgz

25. Network detection

Ping www.taobao.com

26. Telnet

SSH [email protected]

27. Printing information

echo $JAVA _home Print the value of the JAVA home environment variable

28.java Common Commands

Java javacjps, Jstat, Jmap, Jstack

29. Other Commands

SVN git maven

Linux commands that Java programmers must master

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.