記錄一些無論怎麼記用的時候還是要查的Linux命令

1、查看端口被佔用

  • lsof -i:端口號
  • netstat -tunlp|grep 端口號
  • netstat -anp|grep 端口號

 

2、清屏

  • ctrl+l

 

3、添加用戶設置密碼

  • useradd testuser  創建用戶testuser
  • passwd testuser  給已創建的用戶testuser設置密碼

 

4、端口轉發【本機端口轉發】

如果只需要在本機間不同的端口轉發就比較容易了,比如 訪問 http://ip:729 我想返回 http://ip:80 的內容,配置如下:

  • [root@localhost sbin]# iptables -t nat -A PREROUTING -p tcp --dport 729 -j REDIRECT --to-ports 80
  • [root@localhost sbin]# service iptables save
  • [root@localhost sbin]# service iptables restart

或者root用戶   vi /etc/sysconfig/iptables

service iptables save

service iptables restart

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章