Linux提供了大量的命令,利用它可以有效地完成大量的工作,如磁盘操作、文件存取、目录操作、进程管理、文件权限设定等。所以,在Linux系统上工作离不开使用系统提供的命令。要想真正理解Linux系统,就必须从Linux命令学起,通过基础的命令学习可以进一步理解Linux系统。
不同Linux发行版的命令数量不一样,但Linux发行版本最少的命令也有200多个。这里笔者把比较重要和使用频率最多的命令,按照它们在系统中的作用分成下面六个部分一一介绍。
◆ 安装和登录命令:login、shutdown、halt、reboot、install、mount、umount、chsh、exit、last;
◆ 文件处理命令:file、mkdir、grep、dd、find、mv、ls、diff、cat、ln;
◆ 系统管理相关命令:df、top、free、quota、at、lp、adduser、groupadd、kill、crontab;
◆ 网络操作命令:ifconfig、ip、ping、netstat、telnet、ftp、route、rlogin、rcp、finger、mail、nslookup
◆ 系统安全相关命令:passwd、su、umask、chgrp、chmod、chown、chattr、sudo ps 、who
◆ 其它命令:tar、unzip、gunzip、unarj、mtools、man、unendcode、uudecode。
-------------------------------------------
查看端口占用情况命令,比如查看80端口占用情况使用如下命令:
lsof -i:3306
lsof -i tcp:80
列出所有端口:netstat -ntlp
Linux 如何打开端口
举例:
开放10000端口的解决步骤如下:
1、修改/etc/sysconfig/iptables文件,增加如下一行:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT
重启 iptables
service iptables restart
2、重启防火墙,这里有两种方式重启防火墙 a) 重启后生效
开启: chkconfig iptables on
关闭: chkconfig iptables off b) 即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
3、或者用menu-system-administration-firewall
去添加用户需要的端口。
By the way:
a. netstat -tanp 去显示端口状态。
/usr/sbin/lsof -i
b. telnet ipaddr port
to check if ip and port is available before making connection.
http://www.savh.cn/thread-8.htm
转载请注明:Savh.Cn 发表