natstat -vat
v:verbose
a: all
t: tcp
[iyunv@rhel01 ~]# netstat -vat
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:34028 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:sunrpc 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:ssh 0.0.0.0:* LISTEN
tcp 0 0 localhost:ipp 0.0.0.0:* LISTEN
tcp 0 0 localhost:smtp 0.0.0.0:* LISTEN
tcp 0 64 localhost:ssh localhost:49512 ESTABLISHED
tcp6 0 0 [::]:sunrpc [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:ipp [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
tcp6 0 0 [::]:56828 [::]:* LISTEN
[iyunv@rhel01 ~]# netstat -vatn
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 0.0.0.0:34028 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN
tcp 0 64 192.168.40.131:22 192.168.40.1:49512 ESTABLISHED
tcp6 0 0 :::111 :::* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
tcp6 0 0 ::1:25 :::* LISTEN
tcp6 0 0 :::56828 :::* LISTEN
如果是 u,则为 udp
查看 ssh 是否开启
netstat -vatn: 看端口号。一般 Linux 看端口号。
看 dns 是哪个文件?
/etc/resolv.conf
vim:
:e! 放弃所有更改,重新开始新的编辑
dw cw 经常用
r 字符:好像是删除字符
wget:
[iyunv@rhel01 ~]# wget ftp://test:test@192.168.1.104/a.txt
--2014-07-19 21:58:24-- ftp://test:*password*@192.168.1.104/a.txt
=> “a.txt”
正在连接 192.168.1.104:21... 已连接。
正在以 test 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> 不需要 CWD。
==> SIZE a.txt ... 58
==> PASV ... 完成。 ==> RETR a.txt ... 完成。
长度:58 (非正式数据)
100%[=======================================================================================>] 58 --.-K/s 用时 0s
2014-07-19 21:58:24 (3.43 MB/s) - “a.txt” 已保存 [58]
-r 可以把整个文件 recursive 下来
[iyunv@rhel01 testwget]# pwd
/tmp/testwget
[iyunv@rhel01 testwget]# ls
[iyunv@rhel01 testwget]# !wget
wget -r ftp://test:test@192.168.1.104
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/
=> “192.168.1.104/.listing”
正在连接 192.168.1.104:21... 已连接。
正在以 test 登录 ... 登录成功!
==> SYST ... 完成。 ==> PWD ... 完成。
==> TYPE I ... 完成。 ==> 不需要 CWD。
==> PASV ... 完成。 ==> LIST ... 完成。
[ ] 167 --.-K/s 用时 0s
2014-07-19 22:14:12 (17.0 MB/s) - “192.168.1.104/.listing” 已保存 [167]
已删除 “192.168.1.104/.listing”。
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/a.txt
=> “192.168.1.104/a.txt”
==> 不需要 CWD。
==> PASV ... 完成。 ==> RETR a.txt ... 完成。
长度:58
100%[======================================>] 58 --.-K/s 用时 0s
2014-07-19 22:14:12 (6.84 MB/s) - “192.168.1.104/a.txt” 已保存 [58]
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/b.txt
=> “192.168.1.104/b.txt”
==> 不需要 CWD。
==> PASV ... 完成。 ==> RETR b.txt ... 完成。
长度:58
100%[======================================>] 58 --.-K/s 用时 0s
2014-07-19 22:14:12 (7.00 MB/s) - “192.168.1.104/b.txt” 已保存 [58]
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/wina/
=> “192.168.1.104/wina/.listing”
==> CWD (1) /wina ... 完成。
==> PASV ... 完成。 ==> LIST ... 完成。
[ ] 108 --.-K/s 用时 0s
2014-07-19 22:14:12 (9.40 MB/s) - “192.168.1.104/wina/.listing” 已保存 [108]
已删除 “192.168.1.104/wina/.listing”。
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/wina/c.txt
=> “192.168.1.104/wina/c.txt”
==> 不需要 CWD。
==> SIZE c.txt ... 完成。
==> PASV ... 完成。 ==> RETR c.txt ... 完成。
[ ] 0 --.-K/s 用时 0s
2014-07-19 22:14:12 (0.00 B/s) - “192.168.1.104/wina/c.txt” 已保存 [0]
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/wina/b/
=> “192.168.1.104/wina/b/.listing”
==> CWD (1) /wina/b ... 完成。
==> PASV ... 完成。 ==> LIST ... 完成。
[ ] 111 --.-K/s 用时 0s
2014-07-19 22:14:12 (9.42 MB/s) - “192.168.1.104/wina/b/.listing” 已保存 [111]
已删除 “192.168.1.104/wina/b/.listing”。
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/wina/b/read.txt
=> “192.168.1.104/wina/b/read.txt”
==> 不需要 CWD。
==> SIZE read.txt ... 完成。
==> PASV ... 完成。 ==> RETR read.txt ... 完成。
[ ] 0 --.-K/s 用时 0s
2014-07-19 22:14:12 (0.00 B/s) - “192.168.1.104/wina/b/read.txt” 已保存 [0]
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/wina/b/c/
=> “192.168.1.104/wina/b/c/.listing”
==> CWD (1) /wina/b/c ... 完成。
==> PASV ... 完成。 ==> LIST ... 完成。
[ ] 57 --.-K/s 用时 0s
2014-07-19 22:14:12 (2.56 MB/s) - “192.168.1.104/wina/b/c/.listing” 已保存 [57]
已删除 “192.168.1.104/wina/b/c/.listing”。
--2014-07-19 22:14:12-- ftp://test:*password*@192.168.1.104/wina/b/c/bb.xls
=> “192.168.1.104/wina/b/c/bb.xls”
==> 不需要 CWD。
==> PASV ... 完成。 ==> RETR bb.xls ... 完成。
长度:7168 (7.0K)
100%[======================================>] 7,168 --.-K/s 用时 0.002s
2014-07-19 22:14:12 (3.74 MB/s) - “192.168.1.104/wina/b/c/bb.xls” 已保存 [7168]
FINISHED --2014-07-19 22:14:12--
Total wall clock time: 0.07s
Downloaded: 5 files, 7.1K in 0.002s (3.66 MB/s)
[iyunv@rhel01 testwget]# ls
192.168.1.104
[iyunv@rhel01 testwget]#
[iyunv@rhel01 testwget]# wget www.baidu.com
--2014-07-19 22:18:34-- http://www.baidu.com/
正在解析主机 www.baidu.com (www.baidu.com)... 61.135.169.125, 61.135.169.105
正在连接 www.baidu.com (www.baidu.com)|61.135.169.125|:80... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:未指定 [text/html]
正在保存至: “index.html”
[ ] 53,059 --.-K/s 用时 0.04s
2014-07-19 22:18:34 (1.38 MB/s) - “index.html” 已保存 [53059]
[iyunv@rhel01 testwget]# ls
192.168.1.104 index.html
firefox
file 协议: file:///etc
links: 非 GUI web browser
links 在 elinks rpm 中
[iyunv@rhel01 Packages]# rpm -ivh elinks-0.12-0.36.pre6.el7.x86_64.rpm nss_compat_ossl-0.9.6-8.el7.i686.rpm nss_compat_ossl-0.9.6-8.el7.x86_64.rpm
email and message:
1. Evolution 2. Thunderbird 3. Mutt 4. Pidgin
Remte Access & File Transfer
sftp://127.0.0.1
sftp 是 SSH 的一个子协议
SSH 包名 OpenSSH (Secure Remote Shell)
scp: secure copy
scp [user@]host:/path/to/file
-r
-p: 权限也 copy 过来
-C: 压缩
包名 OpenSSH
server
client
ssh
rpm -qa | grep ssh
rpm -qi OpenSSH
-i: information
ifconfig eno16777736 192.168.1.111/24
Vmware 虚拟出来两个网卡
Host Only: 使用 VMNet1
NAT: 使用 VMNet8
Bridging: 使用主机物理网卡
ssh root@192.168.40.133
ssh 192.168.40.133 ifconfig
~/.ssh/known_hosts
scp /etc/fstab root@192.168.40.133:/tmp/fstab.alllen
scp root@127.0.0.1:/etc/inittab
scp root@192.168.40.133:/tmp/rhel-m2 allen@192.168.40.131:/home/allen
rsync: 大量文件需要 copy, 只 copy 变化de
加密:对称,非对称
rsa:非对称加密算法
ssh-keygen
ssh-copy-id
#ssh-keygen
#ssh-copy-id -i .ssh/id_rsa.pub 192.168.40.133
#ls ~/.ssh/id*
#ssh 127.0.0.1
ftp clients:
lftp
Smaba: smbclient -L //192.168.40.1 -U root %r
ping -C4 192.168.40.1
traceroute www.baidu.com
/etc/gshadow:7已经不用了
密码策略在: /etc/shadow 中
/etc/login.defs
useradd
usermod
userdel -r: 这个 -r 非常重要,否则不安全
一个 boss, 走了,删除没用 -r, 留下 /home/boss,
新来的用户创建用户名时,会自动把 boss 的 /home/boss 的组分给新的用户的。这样新的用户可以访问 boss 的文件夹
usermod -l newname oldname
root 的名字也可以改,但是要在 /etc/passwd 和 /etc/shadow 中都改
用户正在登陆呢, root 无法改他的名字
cat /etc/selinux/config
/var/log/dmesg: 内核日志文件
/var/log/secure
wc -l /var/log/messages
pam 文件
man usermod
/Lock
考试时主要考组的概念,所以 -G 很重要
w:
last:
lastb:
lastlog:
umask:
root 的 umask 0022
普通用户的umask 0002
666 777
folder = 777 - umask
file = 666 - umask
suid: 调用的用户,调用文件所有者的权限去操作
sgid
rws r-x r-x
u g o
suid sgid stid
cp mv rm
findmnt: 看分区的文件类型
findmnt /: xfs
ext4, iso9660:光盘镜像格式
man fstab
/iso
Linux 可直接挂载
hard link
symbolic (soft) link
ln -s /etc/fstab ~/fs
hard link :增加 inode 个数
soft link: 不增加 inode 个数
加入一个文件有多于一个 inode,如何额找到其他的文件的位置
find / -inum 1348996
ls -l /dev/sr0 (光盘)
ls -l /dev/tty
find / -type p (p 表示 pipe)
du -sh /boot
df -h (按照 1024 算)
df -H (按照 1000算)
mount /dev/sr0 /media
umount /dev/sr0
cd mnt
mkdir /mnt/floppy
mount /xxxx floppy
光盘 DVD: eject /dev/cdrom
gnome-mount
findmnt
mount|grep sr0
低版本中必须
mount -o loop Desktop/linux.iso /mnt/iso
否则出错
RHEL 7 则不需要加 -o
如何挂载 ntfs,1.编译内核 2.第三方工具
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com