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

What are the Linux commands that are often asked in interviews?

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

Share

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

The purpose of this article is to share with you the contents of the Linux commands often asked in the interview. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

This article will not explain all commands in detail, but only give common usage and explanation. Specific usage can be used-- help to view help or directly through google search to learn.

-- help

1. Find the file

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

Find /-name filename.txt

Recursively find all xml files

Find. -name "* .xml"

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

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

Find all xml files that contain spring

Grep-H 'spring' * .xml

Delete files with zero file size

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

Find all jar files in the current directory

Ls-l | grep '.jar'

Displays lines that contain test in all files that begin with d.

Grep 'test' d *

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

Grep 'test' aa bb cc

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

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

2. Check whether a program is running

View all processes related to tomcat

Ps-ef | grep tomcat

3. Terminate the thread

Terminate a process with thread number 19979

Kill-9 19979

4. View files, including hidden files

Ls-al

5. Current working directory

Pwd

6. Copy files

Copy a file

Cp source dest

Recursively copy the entire folder

Cp-r sourceFolder targetFolder

Remote copy

Scp sourecFile romoteUserName@remoteIp:remoteAddr

7. Create a directory

Mkdir newfolder

8. Delete the directory

Delete empty directory

Rmdir deleteEmptyFolder

Recursively delete everything in the directory

Rm-rf deleteFile

9. Move files

Mv / temp/movefile / targetFolder

10. Rename

Mv oldNameFile newNameFile

11. Switch users

Su-username

12. Modify file permissions

Permissions for file.java

Chmod 777 file.java

R for read, w for write, x for executable

-rwxrwxrwx

13. Compress the file

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

14. List the compressed files

Tar-tzf test.tar.gz

15. Decompress the file

Tar-xvzf test.tar.gz

16. View the first 10 lines of the file

Head-n 10 example.txt

17. Check the last 10 lines of the file

Tail-n 10 example.txt

18. View log type files

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

Tail-f exmaple.log

19. Execute commands as Super Admin

Delete files using the administrator identity

Sudo rm a.txt

20. Check the port occupancy

View the usage of port 8080

Netstat-tln | grep 8080

21. Check which program the port belongs to

Lsof-I: 8080

22. View the progress

View java processes

Ps aux | grep java

View all processes

Ps aux

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

Tree a

24. File download

Wget http://file.tgzcurl http://file.tgz

25. Network detection

Ping www.just-ping.com

26. Log in remotely

Ssh userName@ip

27. Print information

Print the value of the java home environment variable

Echo $JAVA_HOME

28. Java common commands

Java javac jps, jstat, jmap, jstack

29. Other orders

Svn git maven, thank you for your reading! This is the end of this article on "what are the Linux commands often asked for in the interview?" I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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