Linux运维笔记-文档总结-Liunx入门和简单命令运用

以下操作都是在Red-hat 7.0版本下运行。


1.虚拟机控制
[kiosk@foundation92 ~]$ rht-vmctl start desktop ##打开虚拟机
Starting desktop.

[kiosk@foundation92 ~]$ rht-vmctl view desktop ##显示虚拟机

[kiosk@foundation92 ~]$ rht-vmctl reset desktop ##重置虚拟机

Are you sure you want to reset desktop? (y/n) y ##询问用户是不是确定重置(yes/no)
Resetting desktop.
Powering off desktop..
Creating virtual machine disk overlay for rh124-desktop-vda
Creating virtual machine disk overlay for rh124-desktop-vdb
Starting desktop.
[kiosk@foundation92 ~]$ rht-vmctl poweroff desktop ##关闭虚拟机
Powering off desktop..
这里写图片描述

2.切换用户
命令:su - 用户名称
要注意的是,普通用户转换成超级用户需要密码,超级用户转换成普通用户时是不需要密码的。
[root@foundation92 ~]# su - kiosk ##切换成普通用户,不需要密码
Last login: Thu Mar 30 14:23:47 CST 2017 on pts/0
[kiosk@foundation92 ~]$ su - root ##切换成超级用户,需要密码
Password: ##密码输入无回显
Last login: Thu Mar 30 14:27:22 CST 2017 on tty2
切换普通用户
切换超级用户

3.虚拟控制台
虚拟控制台最有用的时候是当一个程序出错锁住的时候可以切换成其他虚拟控制台。
Ctrl+Alt+F(1|7) 进入图形
Ctrl+Alt+F(2~6) 进入虚拟控制台

4.命令的小帮手
当遇到自己陌生的命令的时候,不要慌,有几个命令可以帮你查询。
命令: whatis 命令 ##介绍命令的功能
命令: 命令 –help ##介绍命令的功能
命令: man 命令 ##介绍命令的功能
[kiosk@foundation92 ~]$ whatis date ##whatis的用法
date (1) - print or set the system date and time
date (1p) - write the date and time

[kiosk@foundation92 ~]$ date –help ##–help的用法
Usage: date [OPTION]… [+FORMAT]
or: date [-u|–utc|–universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

Mandatory arguments to long options are mandatory for short options too.
-d, –date=STRING display time described by STRING, not ‘now’
-f, –file=DATEFILE like –date once for each line of DATEFILE
-I[TIMESPEC], –iso-8601[=TIMESPEC] output date/time in ISO 8601 format.
TIMESPEC=’date’ for date only (the default),
‘hours’, ‘minutes’, ‘seconds’, or ‘ns’ for date
and time to the indicated precision.
-r, –reference=FILE display the last modification time of FILE
………
[kiosk@foundation92 ~]$man date ##man的用法
这里写图片描述
man的date

5.注销用户
命令:gnome-session-quit –force
这里写图片描述

6.简单的系统命令
(1)命令:date ##查看和修改系统时间
命令:date -d +xday ##查看x天后的系统时间
这里写图片描述
这里写图片描述
(2)命令;passwd ##修改用户密码
[root@foundation0 ~]# passwd
修改超级用户密码
Changing password for user root. ##改变超级用户密码
New password: ##输入密码
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: ##确认密码
passwd: all authentication tokens updated successfully.
修改普通用户密码
[kiosk@foundation0 Desktop]$ passwd
Changing password for user kiosk. ##改变普通用户密码
Changing password for kiosk.
(current) UNIX password: ##输入当前密码
New password:
BAD PASSWORD: The password is the same as the old one ##和原始密码不能相似
New password:
BAD PASSWORD: The password fails the dictionary check - it is too simplistic/systematic ##密码必须是无序数字+字母
New password:
BAD PASSWORD: The password is shorter than 8 characters ##密码必须>8位
这里写图片描述

passwd 参数 用户名称
-S student ##用户密码信息
–status student 。。。。。。
-l student ##锁定帐号
-u student ##解锁
-n 1 student ##设定密码最短有效期
-x 30 student ##设定密码最长有效期
-w 3 student ##警告期
-i 2 student ##设定用户非活跃天数
-d student ##清除用户密码
效果图如下:

7.文件的查看
命令: cat ##显示文件全部内容(‘瞄’一下)
命令: less ##可以上下翻页查看(主要使用还是less,more也可以查看,但是不能向上翻页)
这里写图片描述
less的翻页效果图:
8.统计文件容量
命令:wc -l 行数
-w 字数
-c 字节数(常用表示文件大小)
-m 字符数
wc -l的效果图:
9.历史命令的查看
命令:history ##显示历史
hostory -c ##清除当前环境当中的历史命令
!数字 ##执行第多少行命令
!字母 ##执行最近一条以这个字母开头的命令
ctrl +R +关键字 ##执行最近一条含有这个关键字的命令
上下键 ##逐行调用命令
这里写图片描述
history其他参数的使用方法:

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值