linux-打杂命令总结

关闭防火墙

[root@192 ~]# systemctl status firewalld
[root@192 ~]# systemctl stop firewalld
[root@192 ~]# systemctl systemctl disable firewalld.service
[root@192 ~]# systemctl status firewalld

修改IP地址

#修改网卡信息
[root@192 ~]# vi /etc/sysconfig/network-scripts/ifcfg-ens33
#更改IPADDR
[root@192 ~]# ip addr
#重启网卡
[root@192 ~]# systemctl restart network

修改主机名称

#第一种方法
[root@192 ~]# vim /etc/hostname
#修改完需要reboot重启服务器

#第二种方法
[root@192 ~]# hostnamectl set-hostname "myhost"

修改主机映射

[root@192 ~]# vim /etc/hosts
#添加对应映射即可
#192.167.xx.xxx host1
#192.167.xx.xxx host2

节点间免密登录

[atguigu@hadoop152 ~]$ ll -al
[atguigu@hadoop152 ~]$ cd .ssh
[atguigu@hadoop152 .ssh]$ ls
known_hosts
[atguigu@hadoop152 .ssh]$ ssh-keygen -t rsa
[atguigu@hadoop152 .ssh]$ ssh-copy-id hadoop152
[atguigu@hadoop152 .ssh]$ ssh-copy-id hadoop153
[atguigu@hadoop152 .ssh]$ ssh-copy-id hadoop154

#其他节点互相配置
#注意不同用户下的互相免密配置

卸载java

[hahah@hadoop152 ~]$ sudo rpm -qa  | grep -i java | xargs -n1 sudo rpm -e --nodeps

重定向输出

# 0 标准输入
# 1 标准输出
# 2 标准错误输出

# /dev/null 黑洞[不显示]

[atguigu@hadoop152 applog]$ xxx[命令] >/dev/null 2>&1
#等价于
[atguigu@hadoop152 applog]$ xxx[命令] 1>/dev/null 2>&1
#[解释] 1可以省略,将1定向输出到黑洞,2定向输出到1

查看cpu信息

#查看cpu个数
[root@gsgp60 ~]# cat /proc/cpuinfo | grep "physical id" | uniq | wc -l
32
#查看cpu核数
[root@gsgp60 ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores	: 8
#查看cpu型号
[root@gsgp60 ~]# cat /proc/cpuinfo | grep "model name" | uniq
model name	: Intel(R) Xeon(R) CPU E5-2450L 0 @ 1.80GHz

XFTP报错:sftp子系统申请已拒绝

--参考博客
https://www.cnblogs.com/yourstars/p/12965995.html
https://blog.csdn.net/eddy23513/article/details/123677099

猜你喜欢

转载自blog.csdn.net/wangning0714/article/details/131261200