亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊 查看新帖 |

Chinaunix

  平臺 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 2763 | 回復(fù): 8
打印 上一主題 下一主題

[學(xué)習(xí)共享] [ZT]Surfing the Keyboard in BASH [復(fù)制鏈接]

論壇徽章:
7
榮譽(yù)版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07獅子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10雙子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報告]
發(fā)表于 2014-05-08 19:16 |只看該作者 |倒序瀏覽
文章有點(diǎn)兒久了,不過還沒過時,轉(zhuǎn)一下

http://commandlinemac.blogspot.c ... yboard-in-bash.html

Saturday, December 13, 2008
Surfing the Keyboard in BASH
You are probably familiar with common keyboard sequences like Ctrl-C to end a program, but there are dozens of useful shortcuts you can use in BASH to edit the command line, move around your command history, and control jobs. I've collected 18 useful Ctrl and Meta (Option) sequences to make you more productive in BASH. So grab your 'board and leave the wet suit at home, the water is warm this time of year.

Command Line Editing

BASH keyboard sequences come in two flavors, Ctrl and Meta. Ctrl sequences are straightforward, you hold down the Ctrl key while pressing another key. On a PC with Linux, the Meta key is usually mapped to Alt, but on a Mac, it is usually mapped to the Esc key. Since the Esc key is poorly placed for serious keyboarding, I suggest mapping the Meta key to the Option key.

To map Meta to Option in the OS X Terminal, use the menu and go to Terminal / Window Settings, select Keyboard in the drop down box at the top, and check 'Use option key as meta key'.

To map Meta to Option in iTerm, use the menu and go to Bookmarks / Manage Profile, expand Keyboard Profiles, select Global, and check the 'Option Key as Meta' radio button.

With that out of the way, here are some shortcuts to edit commands.
Key Sequence         Result
Ctrl-A         moves the cursor to the beginning of the line
Ctrl-E         moves the cursor to the end of the line
Ctrl-D         deletes the character under the cursor
Ctrl-F         moves the cursor forward one character
Ctrl-B         moves the cursor backward one character
Ctrl-K         deletes from the cursor to the end of the line
Option-B         moves the cursor back one word
Option-F         moves the cursor forward one word
Option-L         downcase a word starting from the cursor
Option-U         upcase a word starting from the cursor
Moving through history

BASH records all commands you enter in a personal history file called .bash_history in your home directory. Notice the dot (.) at the start of the name, indicating it is a hidden file. Finder won't show you hidden files without some tweaking, but you can easily see hidden files in Terminal with the ls -a command. If you are paranoid, BASH has options to turn history off, but it is very useful if you work much at the command line. Here are the history shortcuts:

Key Sequence         Result
Ctrl-R         start an incremental reverse history search, Ctrl-J to stop
Ctrl-S         start an incremental forward history search, Ctrl-J to stop
Ctrl-J         stop incremental search, leaving command to edit
Ctrl-P (also up arrow)         fetch the previous command from history
Ctrl-N (also down arrow)         fetch the next command from history

Incremental searches work by matching the string entered with the most recent history command that contains the string. The more you type, the more accurate the match. Use Ctrl-J (or the left or right arrow keys) to end the search, leaving the matched command on the command line ready to either edit or run.
Job Control

OK, nothing new here...
Key Sequence         Result
Ctrl-Z         suspends the foreground job, returns control to user
Ctrl-C         send signal 3 (SIGQUIT) to the foreground job
Miscellaneous

Key Sequence         Result
Ctrl-X Ctrl-V         show current version of BASH

All examples given above are default key bindings in BASH. There are additional BASH functions that are not automatically bound to a key sequence. To see all current key bindings, plus all unmapped functions, run this command:

bind -P

If you want to set your own key sequences or macros, you can define them in a readline run control file in your home directory called .inputrc (you will need to create one). Readline is a library that provides command line control for BASH. To define a new key sequence, edit the .inputrc file and enter your new definitions one per line. You need to use the readline syntax as follows:

key-sequence: function

\C- means Ctrl plus another key
\M- means Meta (Option) plus another key
\e is the ESC character
\\ is a backslash
\" is a double quote
\' is a single quote

For example, to bind Option-z (meta-z) to the tty-status function, add this line to your .inputrc file:

"\M-z": tty-status

Close Terminal and start a new shell so it reads the .inputrc file, then try Option-z and you should see something like this:

load: 0.61 cmd: bash 10561 running 0.00u 0.00s

You can create your own key sequences for anything BASH supports, or change them to taste. Few people have a burning desire to change the default BASH key sequences, but if you need to change your keyboard surfing style, you know how... dude.

論壇徽章:
33
ChinaUnix元老
日期:2015-02-02 08:55:39CU十四周年紀(jì)念徽章
日期:2019-08-20 08:30:3720周年集字徽章-周	
日期:2020-10-28 14:13:3020周年集字徽章-20	
日期:2020-10-28 14:04:3019周年集字徽章-CU
日期:2019-09-08 23:26:2519周年集字徽章-19
日期:2019-08-27 13:31:262016科比退役紀(jì)念章
日期:2022-04-24 14:33:24
2 [報告]
發(fā)表于 2014-05-08 19:17 |只看該作者
感謝分享

論壇徽章:
5
2015年辭舊歲徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亞洲杯之朝鮮
日期:2015-03-13 22:47:33IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-01-09 06:20:00IT運(yùn)維版塊每周發(fā)帖之星
日期:2016-03-07 16:27:44
3 [報告]
發(fā)表于 2014-05-08 19:24 |只看該作者
好東西。

論壇徽章:
7
榮譽(yù)版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07獅子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10雙子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
4 [報告]
發(fā)表于 2014-05-08 19:37 |只看該作者
回復(fù) 2# Shell_HAT


列幾個自己常用的

C-a: 移到開頭
C-e: 移到最后
刪除光標(biāo)后面的:C-k
刪除光標(biāo)前面的:C-u
C-r: 打開歷史搜索,按回車直接運(yùn)行,按esc不運(yùn)行可以編輯一下然后回車運(yùn)行。

C-z: 將前臺進(jìn)程掛起并放入后臺,然后bg讓其在后臺繼續(xù)運(yùn)行,fg可以再次調(diào)到前臺。

這個是花哨的
M-t:  交換當(dāng)前單詞和前面的單詞,  假設(shè)你想用一個命令又忘記具體用法了,可能已經(jīng)敲上了這個命令,你可以帥氣的鍵入man然后一個alt t,最后用小指優(yōu)雅的kiss那個大大的enter鍵。



   

論壇徽章:
7
榮譽(yù)版主
日期:2011-11-23 16:44:17子鼠
日期:2014-07-24 15:38:07獅子座
日期:2014-07-24 11:00:54巨蟹座
日期:2014-07-21 19:03:10雙子座
日期:2014-05-22 12:00:09卯兔
日期:2014-05-08 19:43:17卯兔
日期:2014-08-22 13:39:09
5 [報告]
發(fā)表于 2014-05-08 19:45 |只看該作者
回復(fù) 3# blackold
黑哥出沒
btw:外殼最近沒見到?

   

論壇徽章:
780
金牛座
日期:2014-02-26 17:49:58水瓶座
日期:2014-02-26 18:10:15白羊座
日期:2014-04-15 19:29:52寅虎
日期:2014-04-17 19:43:21酉雞
日期:2014-04-19 21:24:10子鼠
日期:2014-04-22 13:55:24卯兔
日期:2014-04-22 14:20:58亥豬
日期:2014-04-22 16:13:09獅子座
日期:2014-05-05 22:31:17摩羯座
日期:2014-05-06 10:32:53處女座
日期:2014-05-12 09:23:11子鼠
日期:2014-05-21 18:21:27
6 [報告]
發(fā)表于 2014-05-08 19:58 |只看該作者
學(xué)習(xí)了,多謝分享。

論壇徽章:
5
2015年辭舊歲徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亞洲杯之朝鮮
日期:2015-03-13 22:47:33IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-01-09 06:20:00IT運(yùn)維版塊每周發(fā)帖之星
日期:2016-03-07 16:27:44
7 [報告]
發(fā)表于 2014-05-08 20:29 |只看該作者
回復(fù) 5# r2007


    樓長,我天天來啊。

   歪殼,真是有段時間不見來了 偶爾在某個群里出沒。

論壇徽章:
5
2015年辭舊歲徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亞洲杯之朝鮮
日期:2015-03-13 22:47:33IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-01-09 06:20:00IT運(yùn)維版塊每周發(fā)帖之星
日期:2016-03-07 16:27:44
8 [報告]
發(fā)表于 2014-05-08 20:30 |只看該作者
回復(fù) 4# r2007


    我也經(jīng)常用這些“快捷鍵”,感覺爽了不少。

論壇徽章:
5
2015年辭舊歲徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:50:282015年亞洲杯之朝鮮
日期:2015-03-13 22:47:33IT運(yùn)維版塊每日發(fā)帖之星
日期:2016-01-09 06:20:00IT運(yùn)維版塊每周發(fā)帖之星
日期:2016-03-07 16:27:44
9 [報告]
發(fā)表于 2014-05-08 20:37 |只看該作者
回復(fù) 5# r2007


    你和歪殼都是元老級大神,行蹤不定是常態(tài)。
您需要登錄后才可以回帖 登錄 | 注冊

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報專區(qū)
中國互聯(lián)網(wǎng)協(xié)會會員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP