linux简单使用

查看linux版本

[root@rhcsay ~]# cat /etc/redhat-release

在这里插入图片描述

查看内核版本

[root@rhcsay ~]# uname -r

在这里插入图片描述

查看shell的类型

方法一:

[root@rhcsay ~]# cat /etc/shells

在这里插入图片描述
方法二:

[root@rhcsay ~]# chsh -l

在这里插入图片描述
查看当前默认shell

[root@rhcsay ~]# echo $SHELL

临时修改shell环境变量

[root@rhcsay ~]# SHELL=/bin/sh

#、$代表什么

#:代表root用户(超级管理员用户)
$:代表rhcsa(普通用户)

[root@rhcsay ~]#

这里面root是用户名,rhcsay是主机名

pwd打印工作目录

[root@rhcsay ~]# pwd 
(print work directory)打印工作目录

重启和关闭linux操作系统

重启:reboot,shutdown -r now
关闭:shutdown -n now,poweroff
shutdown -r + 30 'the system will reboot’再过30分钟之后系统会重启,并显示后面消息给所有在线用户

echo #?

[root@rhcsay ~]# echo #?
结果是0代表上一个执行成功,其他都是失败

查看ip地址

[root@rhcsay ~]# ip a
查看所有IP地址

在这里插入图片描述

[root@rhcsay ~]# ifconfig

在这里插入图片描述
注意:Windows上查ip是ipconfig

用户切换

su(switch user)转换用户
su 后面跟用户名
在这里插入图片描述

远程连接(window/linux一样)

ssh root@192.168.81.130

在这里插入图片描述

修改主机名

修改主机名
[root@localhost ~]# hostname server //临时修改,重启linux系统后失效
[root@localhost ~]# hostnamectl set-hostname server  //永久生效,修改的是文件内容。重启linux系统后依旧生效

返回上一目录

[root@localhost ~]#cd ..    //..代表当前工作目录的上一级目录
[root@localhost ~]#cd .		//.代表当前工具

修改普通用户密码

方法一
[root@rhcsa ~]# passwd rhcsa

方法二
[root@rhcsa ~]# echo "rhcsa"|passwd --stdin rhcsa
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

流年ꦿ

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值