linux基础-登录相关知识

目录

  1. shell
  2. 命令提示符
    3.1. PS1
    3.2. 颜色
  3. 登录相关文件
    4.1. /etc/issue
    4.2. /etc/motd
    4.3. /etc/gdm/custom.conf
    4.4. 提示命令wall

终端terminal

  • 查看当前终端设备命令:tty
[root@centos7 ~]#tty
/dev/pts/2
物理终端
  • 控制台(console)
  • 路径/dev/console
虚拟终端(tty:teletypewriters)
  • tty一般有6个,在系统图形界面按ctrl+alt+F[1-6]进行切换
  • 路径/dev/tty[1-6]
  • chvt [1-6]命令切换虚拟终端
图形终端
  • 切换按键ctrl+alt+F7
  • 路径/dev/tty7
  • 启动图形界面命令:startx,xwindos
串行终端
  • 路径/dev/ttyS#
伪终端
  • pty,SSH远程连接
  • /dev/pts/#

shell

  1. shell是用户跟内核交互的接口
  2. linux的命令解释器
  3. shell是高级程序设计语言
查看当前使用的shell
  • echo $SHELL
[root@centos7 ~]#echo $SHELL
/bin/bash
显示系统所有shell
  • cat /bin/shells
[root@centos7 ~]#cat /etc/shells 
/bin/sh
/bin/bash
/sbin/nologin
/usr/bin/sh
/usr/bin/bash
/usr/sbin/nologin
/bin/tcsh
/bin/csh

命令提示符:prompt

正常显示
[root@centos7 ~]#
PS1
提示符的格式变量
[root@centos7 ~]#echo $PS1
\[\e[1;36m\][\u@\h \W]#\[\e[0m\]
格式选项
选项说明
\e\033
\u当前用户
\h主机名简称,如centos7.magedu.com,显示为centos7
\H主机名,如centos7.magedu.com
\w当前工作目录
\W当前工作目录基名
\t24小时时间格式
\T12小时时间格式
\!命令历史数
\#开机后命令历史数
字体颜色、背景色设置
  • PS1格式\e[1;5;F;Bm…\e[0m或者\033[m…\033[0m
  1. 开启颜色设置**\e[1;5;F;Bm**,中间都不是必选项
  2. 关闭颜色设置**\e[0m**
  3. F,(font)字体颜色
  4. B,(backgroud)字体背景色
  5. 1,表示高亮
  6. 5,表示闪烁
# 这里的hhhhh是红字白底

[root@centos7 ~]#echo -e "\e[31;47mhhhhh\e[0m"
hhhhh
[root@centos7 ~]#echo -e "\033[31;47mhhhhh\033[0m"
hhhhh
颜色对应表
F(font)B(backgroud)说明
3040黑色
3141红色
3242绿色
3343黄色
3444蓝色
3545紫红色
3646青蓝色
3747白色

登录相关文件

centos自动登录不需要密码登录图形界面(不建议生产使用)

  • 修改/etc/gdm/custom.conf文件
[root@centos7 ~]# cat /etc/gdm/custom.conf 
# GDM configuration storage

[daemon]
AutomaticLoginEnable=true
AutomaticLogin=root
[security]

[xdmcp]

[chooser]

[debug]
# Uncomment the line below to turn on debugging
#Enable=true

/etc/issue

登录之前在tty终端上的提示信息

参数用法说明
/bInsert the baudrate of the current line.
/dInsert the current date.
/sInsert the system name, the name of the operating system.
/lInsert the name of the current tty line.
/mInsert the architecture identifier of the machine, eg. i486
/nInsert the nodename of the machine, also known as the hostname.
/oInsert the domainname of the machine.
/rInsert the release number of the OS, eg. 1.1.9.
/tInsert the current time.
/uInsert the number of current users logged in.
/UInsert the string “1 user” or " users" where is the number of current users logged in.
/vInsert the version of the OS, eg. the build-date etc.
[root@centos7 ~]#cat /etc/issue
date:time 	is \d - \t 
tty  		is \l
hostname	is \n

\S
Kernel \r on an \m

/etc/motd

登录后提示信息,直接修改该文件即可,编辑内容是什么,登录后就显示什么

wall命令

向所有终端发出一条信息

[root@centos7 ~]#wall "hello world"
[root@centos7 ~]#
Broadcast message from root@centos7.magedu.com (pts/3) (Mon Aug 13 14:12:42 2018):

hello world
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值