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

How to use the sh command in Linux

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to use the sh command in Linux, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand.

Linux common commands sh commands are shell command language interpreters that execute commands to read from standard input or from a file. Communicate with the kernel by entering commands from the user.

Shshell command interpreter

Add that Bourne Again Shell (that is, bash) is a Shell developed by the Free Software Foundation (GNU), which is a default Shell in Linux systems. Bash is not only compatible with Bourne Shell, but also inherits the advantages of C Shell, Korn Shell and so on.

Syntax bash [options] [file] option-c string: the command reads from the string after-c. -I: implement script interaction. -n: check the syntax of the shell script. -x: implement shell script statement-by-statement tracking. The example uses the-x option to trace the script to debug the shell script, which can print out each line of command executed and the current status:

[root@AY1307311912260196fcZ satools] # sh-x check_ssh_login.sh + DEFINE=30 + cat / var/log/secure + awk'/ Failed/ {+ + ip [$(NF-3)]} END {for (i in ip) print I "=" ip [I]}'+ + cat / root/satools/black.txt + for i in '`cat / root/satools/ black.txt`' + + echo 121.42.0.1601427 + + awk-F ='{print $1}'+ IP=121.42.0.16 + + echo 1212. 42.0.16 etc/hosts.deny 1427 + + awk-F ='{print $2}'+ NUM=1427 +'['1427-gt 30']'+ grep 121.42.0.16 / etc/hosts.deny +'[1-gt 0']'+ echo sshd:121.42.0.16 + echo vsftpd:121.42.0.16 + for i in '`cat / root/satools/ black.txt` + + echo 121.42.0.72276 + + awk-F =' {print $1}'+ IP=121.42.0.72 + + awk -F ='{print $2}'+ + echo 121.42.0.72276 + NUM=276 +'['276-gt 30']'+ grep 121.42.0.72 / etc/hosts.deny +'[1-gt 0']'+ echo sshd:121.42.0.72 + echo vsftpd:121.42.0.72 Thank you for reading this article carefully I hope the article "how to use sh commands in Linux" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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

Development

Wechat

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

12
Report