走进shell

本文介绍了Linux系统启动时自动创建的虚拟控制台,如何使用tty命令查看和setterm命令设置终端属性。还提及了shell作为用户与操作系统交互的命令解释器,重点介绍了Bashshell的广泛使用。
摘要由CSDN通过智能技术生成

Linux系统启动时,会自动创建多个虚拟控制台。虚拟控制台是运行在Linux系统内存中的终端会话。
打开Linux控制台Terminal使用tty命令查看当前使用的虚拟控制台。
注:tty 表示电传打字机(teletypewriter)

$ tty
/dev/pts/0

表示当前使用的是/dev/pts/0 虚拟控制台。

同时可以使用setterm命令设置终端属性,例如

#交换屏幕背景色和前景色  如下图
$ setterm --inversescreen on

inversescreen off:
在这里插入图片描述
inversescreen on:
在这里插入图片描述
setterm帮助手册如下:

$ setterm --help

Usage:
 setterm [options]

Set the attributes of a terminal.

Options:
 --term          <terminal_name>   override TERM environment variable
 --reset                           reset terminal to power-on state
 --resize                          reset terminal rows and columns
 --initialize                      display init string, and use default settings
 --default                         use default terminal settings
 --store                           save current terminal settings as default
 --cursor        [on|off]          display cursor
 --repeat        [on|off]          keyboard repeat
 --appcursorkeys [on|off]          cursor key application mode
 --linewrap      [on|off]          continue on a new line when a line is full
 --inversescreen [on|off]          swap colors for the whole screen
 --foreground    default|<color>   set foreground color
 --background    default|<color>   set background color
 --ulcolor       [bright] <color>  set underlined text color
 --hbcolor       [bright] <color>  set half-bright text color
                 <color>: black blue cyan green grey magenta red white yellow
 --bold          [on|off]          bold
 --half-bright   [on|off]          dim
 --blink         [on|off]          blink
 --underline     [on|off]          underline
 --reverse       [on|off]          swap foreground and background colors
 --clear         [all|rest]        clear screen and set cursor position
 --tabs          [<number>...]     set these tab stop positions, or show them
 --clrtabs       [<number>...]     clear these tab stop positions, or all
 --regtabs       [1-160]           set a regular tab stop interval
 --blank         [0-60|force|poke] set time of inactivity before screen blanks
 --dump          [<number>]        write vcsa<number> console dump to file
 --append        [<number>]        append vcsa<number> console dump to file
 --file          <filename>        name of the dump file
 --msg           [on|off]          send kernel messages to console
 --msglevel      0-8               kernel console log level
 --powersave     [on|vsync|hsync|powerdown|off]
                                   set vesa powersaving features
 --powerdown     [0-60]            set vesa powerdown interval in minutes
 --blength       [0-2000]          duration of the bell in milliseconds
 --bfreq         <number>          bell frequency in Hertz
 --help                            display this help
 --version                         display version

For more details see setterm(1).

以上,通过各种命令于在终端下于Linux系统进行交互,使用的正是shell:
在这里插入图片描述
shell 通过提示您输入,向操作系统解释该输入,然后处理来自操作系统的任何结果输出,简单来说shell就是一个用户跟操作系统之间的一个命令解释器。

常见的 shell 有:

  • Bourne Shell(/usr/bin/sh或/bin/sh)
  • Bourne Again Shell(/bin/bash)
  • C Shell(/usr/bin/csh)
  • K Shell(/usr/bin/ksh)
  • Shell for Root(/sbin/sh)

最常用的shell是Bash,也就是Bourne Again Shell。Bash由于易用和免费,在日常工作中被广泛使用,也是大多数Linux操作系统默认的Shell环境。将在下篇文章中展开介绍。

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值