走进shell

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环境。将在下篇文章中展开介绍。

相关推荐

  1. shell编程

    2024-01-11 07:28:01       44 阅读
  2. 云原生:微服务技术的崭新篇章

    2024-01-11 07:28:01       22 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-01-11 07:28:01       18 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-01-11 07:28:01       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-01-11 07:28:01       18 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-01-11 07:28:01       20 阅读

热门阅读

  1. Rust 工作空间

    2024-01-11 07:28:01       36 阅读
  2. kafka连接失败时springboot项目启动停机问题

    2024-01-11 07:28:01       37 阅读
  3. 网站优化之压缩页面输出

    2024-01-11 07:28:01       35 阅读
  4. Kotlin 1.7.0 beta发布,改进构建器类型推断

    2024-01-11 07:28:01       36 阅读
  5. React16源码: React中的setState和forceUpdate源码实现

    2024-01-11 07:28:01       36 阅读
  6. React16源码: React中的不同的expirationTime的源码实现

    2024-01-11 07:28:01       38 阅读
  7. 我们才能在面试的舞台上闪耀光芒

    2024-01-11 07:28:01       39 阅读
  8. 编程语言的新趋势

    2024-01-11 07:28:01       38 阅读