Linux 查看 端口占用 磁盘空间 远程拷贝 scp

查看端口

netstat -an

[root@ftp /]# netstat -anp|grep java

tcp000.0.0.0:82660.0.0.0:*LISTEN11962/java

tcp00:::8002:::*LISTEN11962/java

tcp00:::8066:::*LISTEN11962/java

tcp00::ffff:127.0.0.1:8003:::*LISTEN20436/java

tcp00::ffff:127.0.0.1:8005:::*LISTEN18515/java

tcp00::ffff:127.0.0.1:8103:::*LISTEN11962/java

tcp00:::8009:::*LISTEN18515/java

tcp00:::8011:::*LISTEN20436/java

tcp00:::10000:::*LISTEN11962/java

tcp00:::8086:::*LISTEN20436/java

tcp00:::8888:::*LISTEN18515/java

tcp00::ffff:127.0.0.1:58419::ffff:127.0.0.1:3306ESTABLISHED18515/java

tcp00::ffff:000.000000000:44186::ffff:172.16.0.37:57788ESTABLISHED11962/java

tcp00::ffff:000.000000000:50398::ffff:000.000000000:3306ESTABLISHED11962/java

tcp00::ffff:000.000000000:51171::ffff:172.16.0.43:39673ESTABLISHED11962/java

tcp00::ffff:000.000000000:47978::ffff:000.000000000:3306ESTABLISHED11962/java

tcp00::ffff:127.0.0.1:48738::ffff:127.0.0.1:3306ESTABLISHED18515/java

tcp00::ffff:127.0.0.1:45878::ffff:127.0.0.1:3306ESTABLISHED18515/java

tcp00::ffff:127.0.0.1:39391::ffff:127.0.0.1:3306ESTABLISHED20436/java

tcp00::ffff:127.0.0.1:40047::ffff:127.0.0.1:3306ESTABLISHED20436/java

tcp00::ffff:000.000000000:56304::ffff:172.16.0.37:57788ESTABLISHED11962/java

tcp00::ffff:127.0.0.1:37961::ffff:127.0.0.1:3306ESTABLISHED18515/java

tcp00::ffff:000.000000000:52309::ffff:172.16.0.30:52031ESTABLISHED11962/java

unix2[]STREAMCONNECTED317724620436/java

unix2[]STREAMCONNECTED315518618515/java

unix2[]DGRAM315517518515/java

unix  2      [ ]         DGRAM                    3061808 11962/java         

000.0000000为公网ip,(安全起见)

查看端口属于哪个程序?端口被哪个进程占用

lsof -i :8086

[root@ftp bin]# lsof -i:8086

COMMANDPIDUSERFDTYPEDEVICESIZENODENAME

java    20436 root    5u  IPv6 3177054       TCP *:8086 (LISTEN)

查看磁盘空间

[root@localhost ~]# df -h

文件系统 容量 已用 可用 已用% 挂载点

/dev/sda3              19G  6.4G   12G  36% /

/dev/sda295G28G63G31%/home

/dev/sda199M12M83M12%/boot

tmpfs                 2.0G     0  2.0G   0% /dev/shm

查看具体文件目录空间信息

[root@localhost ~]#du --max-depth=1 -h

[root@ftp /]# pwd

/

[root@ftp/]#du--max-depth=1-h

66M./public

3.7G./usr

61M./etc

5.6M./boot

100K./tftpboot

2.1M./root

0./misc

8.0K./srv

8.0K./scripts

116K./tmp

44K./logs

0./proc

0./sys

16K./lost+found

8.0K./selinux

2.9G./mnt

26G./home

248M./var

32M./sbin

0./net

88K./dev

8.0K./opt

35M./back

8.0K./media

7.2M./bin

79M./lib

33G     .

linux对linux 远程拷贝   scp命令

scp 文件名  root@远程ip:/路径/

将本地home目录下的test.tar的文件拷贝到远程主机192.168.1.23的/home/adm/目录下,则命令为:scp /home/test.tar [email protected]:/home/adm/  回车后输入密码就可以了

scp提供了几个选项  在scp后加就行了

    -p 拷贝文件的时候保留源文件建立的时间。

-q执行文件拷贝时,不显示任何提示消息。

-r拷贝整个目录

-v拷贝文件时,显示提示信息。

相关推荐