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的安装,我一直觉得挺麻烦的,因为之前安装时就是由于复杂的配置导致有点晕.今 ...
随机推荐
- Vue3.x全家桶+vite+TS-搭建Vue3.x项目
目录 一.搭建基础项目 1.vite创建项目 3.运行项目 2.环境变量设置介绍 vite配置多环境打包 二.配置Router 1.安装路由 2.配置路由 3.引入 三.配置Vuex 1.安装vuex ...
- mac下使用vscode技巧
1.查找 command + F 2.查找并替换 选中要替换的文字 再 command + options + F 3.竖状区域部分替换 鼠标点中替换字段的开头或者结尾,按options + s ...
- CodeForce-799B T-shirt buying (STL_set)
有 n 件T恤.第 i 件T恤的价格为 pi .每个T恤有两面,第 i 件T恤正面颜色为 ai ,反面颜色为 bi . 有 m 个人想买T恤,每个人都恰好买一件.第 j 个人最喜欢颜色 cj. 一个人 ...
- 【C++周报】第二期 2021-8-19
这次我们照样看一道题.个人认为比上一次的简单. https://vijos.org/p/1130 先说方法,动态规划,你能想到什么? "在它的左边加上一个自然数,但该自然数不能超过原数的一半 ...
- vscode快速添加引号 批量增加引号(用于批量格式化代码)
一.在浏览器中将Params复制到pycharm的py文件中 二.选中需要添加引号的部分,Ctrl+H 调出替换工具栏 三.填写正则表达式 (.*?): (.*) '$1':'$2', 右侧注意点击使 ...
- npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
解决: npm install -g npm-install-peers npm install -g npm npm i ajv 但是好像没啥用
- win10系统移动热点使用技巧
win10系统是自动移动热点功能,在平时测试的时候,有时需要进行手机抓包,需要手机和电脑处于同一网络当中,这时可以开启热点使用. 如何开启移动热点? 直接搜索"移动热点" 但是如果 ...
- 自学 Python,视频教程和代码一看就懂,动手就废,应该这么学
一.代码量太少了,看得多做得少,导致一做就错. 每一个测试工程师必定是在大量的时间和代码中提升的自己,如果你只是看视频的话,那永远都停留在理论上,很多问题是要实践才能发现的 我打个比方你看视频的时 ...
- 深入浅出WPF-06.Binding(绑定)01
Binding(绑定) 先上图,再解释 针对这个图,我们先来说说什么是Binding. Binding就是一个桥梁,建立在数据和UI之间的桥梁.既然是数据驱动,那么我们就把数据称之为"源&q ...
- Douban Top 250爬虫
# Ref: https://fishc.com.cn/forum.php?mod=viewthread&tid=101887&extra=page%3D1%26filter%3Dty ...