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 common commands in linux?

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

Share

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

Today, I will talk to you about the specific commands commonly used in linux, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following contents for you. I hope you can get something according to this article.

Do not say much, warm tips, commonly used commands, will also rule out cd, pwd and so on

More detailed commands can be used to man, such as man ls

1. Find the network port

Ethtool-p eth0 the server network port light will be on at this time.

2. Network card information

Ethtool eth0

3. Read and write the test disk

Dd if=/dev/zero of=/home/oracle/my_test.iso bs=8k count=20000 conv=fdatasync

4. Bare device size

Blockdev-getsize / dev/raw/raw1

11718750

11718750 indicates how many OS BLIOCK there are.

Generally speaking, the size of an OS BLOCK is 512 bytes, so 11718750mm 512max 1024max 1024max 1024 = 5722 (m) is the size of the bare device.

5. Replace the strings in the file in batch

Sed-I "s/oldstr/newstr/g" `grep oldstr-rl / home/oracle/test/* `

6. Show all users with active processes

Ps-eo user | sort-u

7. Change the contents of the file into one line

Cat filename | tr-d "\ n"

8. Filter comments in the point file

Cat filename | grep-v'#'

9. Clean up empty lines

Sed'/ ^ $/ d' / tmp/test.txt > / tmp/testnew.txt

10. Show the top ten memory-consuming processes

Ps aux | sort-nk + 4 | tail

11. Recursive ls

Ls-lR.

12. Load the image file

Mount-t iso9660-o loop test.iso / mnt

13. Look for duplicate lines in the file

Cat test.txt | sort | uniq-dc

14. Monitor the connection of a port

Watch-n 1 'netstat-tn | grep-P: 22'

15. Display the currently active tcp connection

Netstat-plnt

16. List processes by cpu utilization

Ps-ef-- sort=-%cpu | more

Or

Ps aux | sort-nk 3 | more

17. Show the distribution

Cat / proc/version

18. Find out who opened the port number

Lsof-I: 22

19. Cpu resource usage

Mpstat-P ALL 2 2

20. Output content in tabular form

Mount | column-t

Cat / etc/passwd | column-t-s: # with':'as the separator

Convert the contents of the file to uppercase

Cat text.txt | tr Amurz Amurz > output.txt

22. List all connections with port 22

Ss state all sport =: ssh

23. Compare the contents of the document

Diff text01.txt text02.txt

24. Detect small commands, which run every two seconds by default

Watch for example, the average load of the system at a comfortable time in two seconds

Watch-n 10 'cat / proc/loadavg'

After reading the above, do you have any further understanding of the specific commands commonly used in linux? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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