Linux Ubuntu stty 使用
stty(set tty)命令用于显示和修改当前注册的终端的属性。
该命令是一个用来改变并打印终端行设置的常用命令。
stty -a #将所有选项设置的当前状态写到标准输出中
old_stty_settings=stty -g #保存当前设置
stty “$old_stty_settings” #恢复当前设置
stty -echo #禁止回显,当您在键盘上输入时,并不出现在屏幕上
stty echo #打开回显
stty raw #设置原始输入
stty -raw #关闭原始输入
stty igncr #开启忽略回车符
stty -igncr#关闭忽略回车符
stty iuclc #开启在命令行下,禁止输出大写的方法
stty -iuclc #恢复在命令行下,禁止输出大写的方法
stty olcuc #开启在命令行下禁止输出小写
stty -olcuc#恢复在命令行下禁止输出小写
stty size #打印出终端的行数和列数
stty -a #将所有选项设置的当前状态写到标准输出中
stty -a
输出
speed 38400 baud; rows 31; columns 60; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal
-crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr
icrnl ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0
cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase
-tostop -echoprt echoctl echoke -flusho -extproc
stty -echo #禁止回显,当您在键盘上输入时,并不出现在屏幕上
输入命令也不会显示在屏幕上
stty -echo
stty echo #打开回显 从键盘输入的命令会显示在屏幕上
stty echo
stty raw #设置原始输入
打开以后的效果就是排版上会有些不同
stty raw
例如在运行下面的命令 会这样 排版不清楚,这就是原始输入被打开了
stty -a
speed 38400 baud; rows 32; columns 122; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
stty -raw #关闭原始输入
stty -raw
在运行上面的命令
stty -a
speed 38400 baud; rows 31; columns 60; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D;
eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q;
stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V;
discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal
-crtscts
-ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr
icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0
cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase
-tostop -echoprt echoctl echoke -flusho -extproc
输出会经过排版了
stty igncr #开启忽略回车符
stty igncr
要是在终端shell 输入这个命令 终端就不能就收回车了
那么怎么执行命令呢 这代码只能在 shell 脚本文件中运行吗
stty -igncr#关闭忽略回车符
stty -igncr
运行 忽略回车的命令后,不知道怎么运行下面的命令…
只能重启shell
stty iuclc #开启在命令行下,禁止输出大写的方法
stty iuclc
这样在shell 终端中就输入不了大写
stty -iuclc #恢复在命令行下,禁止输出大写的方法
stty -iuclc
执行后 就可在终端再次输入大写字母
stty olcuc #开启在命令行下禁止输出小写
stty olcuc
禁止小写 ,要在shell终端中运行这个代码,估计又要重启shell了…
这样的代码只能在shell脚本中用吧
stty -olcuc#恢复在命令行下禁止输出小写
stty -olcuc
stty size 打印出终端行列
stty size
31 60
下面是shell stty -echo 这个命令适合输入密码
#!/bin/sh
stty -echo
echo -n "Please Put in your password:"
read password
stty echo
echo -e "\nYour password is: $password"
Linux Ubuntu stty 使用的更多相关文章
- Linux command stty
Linux command stty reference: https://blog.csdn.net/lqxandroid2012/article/details/78929506 [Purpose ...
- Arch Linux 安装博通 BCM4360 驱动(Arch Linux, Ubuntu, Debian, Fedora...)
BCM4360 在2010年9月,博通完全开源的硬件驱动[1].该驱动程序 brcm80211已被列入到自2.6.37之后的内核中.随着2.6.39发布,这些驱动程序已被重新命名为 brcmsmac和 ...
- 在Linux(Ubuntu)下搭建ASP.NET Core环境并运行 继续跨平台
最新教程:http://www.cnblogs.com/linezero/p/aspnetcoreubuntu.html 无需安装mono,在Linux(Ubuntu)下搭建ASP.NET Core环 ...
- Linux ubuntu 10.10安装OpenCv
在windows系统下已经成功做出了一个打开摄像头并检测人脸的小程序了. 开始转战linux,因为最终目标是将程序移植到嵌入式开发板上面. 但是,问题接踵而至~ 首先linux上面要安装OpenCv, ...
- windows远程连接Linux(Ubuntu)的方法
需要做的工作: 1.在Linux(Ubuntu)端安装.设置好SSH 2.下载putty,并通过putty的SSH连接登录Linux 一 .如何在Linux(Ubuntu)端安装.设置好SSH,获取I ...
- lampp 在linux ubuntu下自动开机启动
lampp 在linux ubuntu下自动开机启动 lampp在linux下是不会自动启动的.需要手工处理.如下: 假如,你的lampp安装在 /opt/lampp 目录下,那么可以如下处理: 1. ...
- remote desktop connect btw Mac, Windows, Linux(Ubuntu) Mac,Windows,Linux之间的远程桌面连接
目录 I. 预备 II. Mac连接Windows III. Windows连接Mac IV. Windows连接Ubuntu V. Mac连接Ubuntu VI. Ubuntu连接Mac VII, ...
- linux ubuntu系统下,adb不是内部命令 (如何才能让adb命令可以使用)
linux ubuntu系统下,adb不是内部命令 原文地址 linux ubuntu系统下,adb不是内部命令 解决方法: 1.sudo gedit ~/.bashrc 2.将下面的两句加到上面打开 ...
- Linux(Ubuntu)下MySQL的安装与配置
转自:http://www.2cto.com/database/201401/273423.html 在Linux下MySQL的安装,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕.今 ...
随机推荐
- PHP的zlib压缩工具扩展包学习
总算到了我们压缩相关扩展的最后一篇文章了,最后我们要学习的也是 Linux 下非常常用的一种压缩格式:.gz 的压缩扩展.作为 PHP 的自带扩展,就像 zip 一样,zlib 扩展是随着 PHP 的 ...
- Linux系列(28) - 软件包简介
软件包分类 源码包(脚本安装包) 优点 开源,如果有足够的能力,可以修改源代码: 可以自由选择所需的功能: 软件是编译安装,所以更加适合自己的系统,更加稳定.效率更高: 卸载方便: 缺点 安装过程步骤 ...
- python编码问题:UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 68: illegal multibyte sequence
import yaml def test_yaml(): f = open('C:\hogwarts\Scripts\hogwarts-api\demo\yaml_data.yml') print(y ...
- 执行sudo apt-get update,连接失败
问题:sudo apt-get update连接失败 错误:1 http://cn.mirrors.ustc.edu.cn/ubuntu bionic InRelease 连接失败 [IP: 218. ...
- php--laravel --debug--mac
1>安装debug 一.下载xdebug文件 1.将phpinfo();的信息全部输入网址中的框,得到适配的xdebug版本: 网址:http://xdebug.org/wizard.php 2 ...
- Lucene基础入门
1. 数据的分类 结构化数据: 查询方法 数据库 非结构化数据: 查询方法 : (1)顺序扫描法 : 一行一行的看,从头看到尾 (2)全文检索 : 将一部分信息提取出来,重新组织将其变得 ...
- Redis 高可用篇:你管这叫主从架构数据同步原理?
在<Redis 核心篇:唯快不破的秘密>中,「码哥」揭秘了 Redis 五大数据类型底层的数据结构.IO 模型.线程模型.渐进式 rehash 掌握了 Redis 快的本质原因. 接着,在 ...
- WPF进阶技巧和实战07--自定义元素01
完善和扩展标准控件的方法: 样式:可使用样式方便地重用控件属性的集合,甚至可以使用触发器应用效果 内容控件:所有继承自ContentControl类的控件都支持嵌套的内容.使用内容控件,可以快速创建聚 ...
- C语言数组的创建和使用
C语言数组的创建和使用 数组是一组相同类型元素的集合. 一维数组的创建及初始化 //创建int类型的数组 //直接创建:不对数组进行初始化 int arr1[10]; //最常用.好用的创建方式 in ...
- xLua自定义加载器
xLua入门基础 环境配置 github下载xLua文件: xLua是腾讯开发,据说比较先进: 下载下来后将Plugins和XLua文件夹考进项目: Plugins多平台权限:XLua和C#交互: t ...