Linux 学习总结 unit01访问命令行
来源:互联网 发布:glide源码原理 编辑:程序博客网 时间:2024/05/16 01:10
#0. 输入法设置
Application -> System Tools ->Setting -> Regin&Language
->Input Sources
#1.shell
界面”的软件(命令解析器)
- 图形界面shell:Gnome,KDE......
- 命令行式shell:bash,csh,ksh.......
Linux系统缺省的shell类型为bash
##1.1.打开shell的4种方式
快捷键:
ctrl+shift+n //打开一个新的shell
ctrl+shift+t //在一个窗口中打开新的table
alt+数字 //当为alt+2时代表切换到第二个
table
ctrl+shift+PgUp/PgDn //将table前移/后移
##1.2.退出shell
exit
ctrl+d
logout
##1.3GNOME常用快捷操作
• Ctrl+Alt+L /win+L//锁屏
• Alt + F1 //打开主菜单Application
• Alt + F10 //最大化当前窗口
• Ctrl+Shift+PrtSc //截取选中的屏幕
• Alt + Tab //切换窗口
• Alt + F4 //关闭窗口
#2.
##2.1.命令行提示符:
[用户名 分隔符@ 主机名 当前所在目录] 身份提示符
[root@fundation77 desktop]#
[stu@localhost 桌面]$
[kiosk@foundation0 Desktop]$:
kiosk //开启shell的用户
@ //分隔符
foundation0 //主机的短名称,表示shell开启在那台主机里
Desktop //表示你在系统的什么位置
$ //身份提示符中的普通用户,超级用户的提示符为:#
##2.2.虚拟控制台
虚拟控制台最有用的时候是当一个程序出错锁住输入时可以切
换到其他虚拟控制台
ctrl+alt+f2~f6 //进入虚拟控制台
ctrl+alt+F1|F7 //回到图形
rht-vmctl start desktop //开启虚拟机desktop
rht-vmctl view desktop //显示虚拟机desktop
rht-vmctl powerofff desktop //强制关闭虚拟机des
##2.3.切换用户:
su -l 用户名 //切换到某个用户,eg:su -l root
//root用户切换到普通用户不需要密码,普通用户切换到root用户需要密码
##2.4.修改用户密码passwd(只能在root用户下修改):
[root@Hello18 桌面]# passwd --help
Usage: passwd [OPTION...] <accountName>
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only)
-l, --lock lock the password for the named account (root only)
-u, --unlock unlock the password for the named account (root only)
-e, --expire expire the password for the named account (root only)
-f, --force force operation
-x, --maximum=DAYS maximum password lifetime (root only)
-n, --minimum=DAYS minimum password lifetime (root only)
-w, --warning=DAYS number of days warning users receives before
password expiration (root only)
-i, --inactive=DAYS number of days after password expiration when an
account becomes disabled (root only)
-S, --status report password status on the named account (root
only)
--stdin read new tokens from stdin (root only)
Help options:
-?, --help Show this help message
--usage Display brief usage message
[root@Hello18 桌面]# 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.
//普通用户student的密码只能在root下修改
[root@Hello18 桌面]# passwd student
Changing password for user student.
New password: //此处不会显示密码
BAD PASSWORD: The password is shorter than 8 characters
Retype new password: //此处不会显示密码
passwd: all authentication tokens updated successfully.
##2.5.怎么获取命令帮助(以passwd为例)
查看帮助的4种方式:
1.passwd --help
[root@Hello18 桌面]# passwd --help
Usage: passwd [OPTION...] <accountName>
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only)
-l, --lock lock the password for the named account (root only)
-u, --unlock unlock the password for the named account (root only)
-e, --expire expire the password for the named account (root only)
-f, --force force operation
-x, --maximum=DAYS maximum password lifetime (root only)
-n, --minimum=DAYS minimum password lifetime (root only)
-w, --warning=DAYS number of days warning users receives before
password expiration (root only)
-i, --inactive=DAYS number of days after password expiration when an
account becomes disabled (root only)
-S, --status report password status on the named account (root
only)
--stdin read new tokens from stdin (root only)
Help options:
-?, --help Show this help message
--usage Display brief usage message
2.man passwd[n向下翻页N向上翻页q退出]
PASSWD(1) User utilities PASSWD(1)
NAME
passwd - update user's authentication tokens
SYNOPSIS
passwd [-k] [-l] [-u [-f]] [-d] [-e] [-n mindays] [-x maxdays] [-w
warndays] [-i inactivedays] [-S] [--stdin] [username]
DESCRIPTION
The passwd utility is used to update user's authentication token(s).
This task is achieved through calls to the Linux-PAM and Libuser API.
Essentially, it initializes itself as a "passwd" service with Linux-PAM
and utilizes configured password modules to authenticate and then
update a user's password.
A simple entry in the global Linux-PAM configuration file for this ser‐
vice would be:
#
# passwd service entry that does strength checking of
# a proposed password before updating it.
------------------------------------------------------------------不赘述
3.pinfo passwd
4./usr/share/doc
##2.6.读懂帮助信息
• [内容] //内容选加• <内容> //内容必加
• 内容... //内容个数任意
#3.shell命令
##3.1.shell中如何使用命令?
1. 命令一定要在提示符之后输入2. 命令的输入方式:命令 参数 目标
参数是命令功能的指定:
-参数 //单词的缩写
--参数 //单词的全拼
##3.2.简单的命令(具体可自行搜索)
1.显示时分秒
date +%H:%M:%S
date +%T
date +%X
2.显示年月日
date +%Y-%m-%d''%x
date +%Y-%m-%d\%x
1.passwd -d username删除密码
2.passwd -l username锁定用户密码
3.passwd -uusername解除锁定
4.passwd -S username查看密码状态
5.passwd -x num username密码最大生存时间
cal -s 周日为第一天的日历
cal -m 周一为第一天的日历
cal -j 显示今天是这一年的多少天
cal -y 这一年的日历
cal -3 显示上个月这个月下个月的日历
1.file -f列出文件中文件名的文件类型
2.file -b列出文件辨识结果时,不显示文件名称。
3.file -c详细显示指令执行过程,便于排错或分析程序执行的情形
4.file -i输出mime类型的字符串
5.file -z尝试去解读压缩文件的内容
1.
head -n 5 filename 显示文档中的前5行
head -n -5 filename 显示文件除了最后n行以外的其他内容
2.head -q filename 隐藏文件名3.head -c filename 显示字节数4.head filename显示文件前10行
5.head -v filename显示文件名
1.tail -n num filename //显示文件的后几行
2.tail -k filename num 从 Number 变量表示的1KB 块位置开始读取指定文件
3.tail -r [-n num] filename 从文件末尾以逆序方式显示输出。
4.tail -c num filename 从 Number 变量表示的字节位置开始读取指定文件。
5.tail -f /var/log/messages 参数-f使tail不停读新内容,实时监视,用Ctrl+c可终止.
1.wc filename显示文件的行数,单词数和字节数
2.wc -l filename显示文件的行数
3.wc -w filename显示文件的单词数
4.wc -c filename显示文件的字节数(注意:1个中文字符=3个字
5.wc -m filename显示文件的字符数
查看历史命令:
1.history查看历史命令
2.history -c清空历史命令
调用历史命令:
3.!数字//执行第(数字)条命令
4.!关键字//执行该关键字开头的命令
5.ctrl+r然后输入关键字//逆向搜索历史命令并执行
##3.3.历史命令调用
!数字 //执行第多少条命令!关键字 //执行最近一条以关键字开头的命令
ctrl+R+关键字 //调出最近一条含有关键字的命令
上下键 //从最后一条命令开始向前查看或者向后查看
history //查看历史
history -c //清除历史
##3.4.命令行常用快捷键
ctrl + a //光标移动到行首ctrl + e //光标移动到行尾
ctrl + u //光标所在位置删除到行首
ctrl + k //光标所在位置删除到行尾
ctrl + r //调出最近一条含有关键字的命令
ctrl + c //撤销已输入的命令
ctrl + d //关闭当前环境
ctrl + shift + t //在现有shell中新打开一table
ctrl + shift + pageup|pagedown //切换table
- Linux 学习总结 unit01访问命令行
- Linux命令行访问网页
- Linux命令行访问网页
- Linux命令行访问网页
- Linux命令行访问网页
- linux命令行下面访问网页
- Linux命令行使用总结
- Linux 命令行快捷键总结
- Linux命令行总结
- Linux命令行netstat总结
- Linux命令行总结
- Flex命令行学习总结
- Linux命令行学习笔记
- linux命令行学习
- Linux 命令行学习笔记
- Linux 命令行学习笔记
- Linux命令行学习笔记
- 《Linux命令行》学习笔记
- 1.判断两个链表是否相交,若相交,求交点。(假设链表不带环)2.判断两个链表是否相交,若相交,求交点。(假设链表可能带环)【升级版】
- notes2016
- kill -9 和 kill -15 的区别
- Spring Boot + Gradle 依赖管理
- Caffe关闭日志输出
- Linux 学习总结 unit01访问命令行
- redis缓存在linux上搭建的过程
- 使用eclipse工程导出jar包
- zookeeper单机伪集群配置
- linux查看多有的用户和组信息
- [python]python中str()与repr()的区别与联系
- tarjan算法总结
- Unity物体跟随鼠标的实现
- FEC改善UDP(RTP)传输音视频的问题