linux 常用工具基本用法

1、系统工具


2、文件管理


3、网络工具


3.1、防火墙(iptables)

iptables -L -n

iptables -A INPUT -p tcp --dport 21 -j ACCEPT

3.2、远程访问(ssh)

  • 远程登录

ssh -l root 192.168.1.100

  • 建立端口映射

ssh -L 2201:localhost:22 192.168.1.100

ssh -R 2201:localhost:22 192.168.1.100

  • 授权(不需要输入密码)
在客户端生成证书
ssh-keygen -t rsa
拷贝证书到远程机器上
scp ~/.ssh/id_rsa.pub  [email protected]
将文件内容追加到授权证书数据库 
cat id_rsa.pub >> ~/.ssh/authorized_keys

4、文本处理

5、文件遍历 (find)

  • 遍历所有文件,排除目录
find . -type f
  • 对所有文件,执行某个操作,比如 touch
find . -type f -exec touch {} \;

你可能感兴趣的:(shell)