Linux Terminal Shortcut

本文介绍了在使用Shell时提高效率的一些实用快捷键,包括光标移动、屏幕清理、命令历史搜索等操作,帮助用户更快地执行任务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# Ctrl A - Go to the beginning of the line you are currently typing on

# Ctrl E - Go to the end of the line you are currently typing on

切到命令行开始|结尾

# Ctrl xx - Move between EOL and current cursor position

光标在当前行的开头和结尾切换

# Ctrl L - Clears the Screen, similar to the clear command

清屏,类似于 clear 命令

# Ctrl U - Clears the line before the cursor position. If you are at the end of the line, clears the entire line.

清除光标之前的所有内容

# Ctrl K - Clear the line after the cursor

清除光标之后的所有内容

 

# Ctrl H - Same as backspace

退格键 backspace

# Alt F - Move cursor forward one word on the current line

光标向前移动一个词的距离

# Alt B - Move cursor backward one word on the current line

光标向后移动一个词的距离

在图形界面下使用终端时会与Alt+F(打开file菜单)冲突,可以在 keyboard Shortcuts选项中禁用file菜单项,即 (x)Disable all menu access keys(such as Alt+f to open File menu)这样就可以用shell自身的shortcuts了。

# Ctrl R - Let’s you search through previously used commands

从命令历史中找

# Ctrl C - Kill whatever you are running

终止命令

# Ctrl D - Exit the current shell

退出 shell

# Ctrl Z - Puts whatever you are running into a suspended background process. fg restores it.

这个指你想中断一下当前执行的程序,但又不想杀死它,可以把它放到后台,想继续执行时,用fg可以唤醒它。

# Ctrl W - Delete the word before the cursor

清除光标之前的一个词,一般是以空格格开,不会删一行。

# Alt D - Delete word after the cursor

向后删一个词

# Ctrl T - Swap the last two characters before the cursor

交换光标前的最后两个字符

# Esc T - Swap the last two words before the cursor

交换光标前的最后两个单词

 

# Tab - Auto-complete files and folder names

自动补全

# Ctrl Y - to paste it (as in delete and copy) all text in front of the cursor

粘贴(刚才 ctrl w 或者 ctrl k 的内容)

# Esc . (or Esc Underscore) - Insert Last Argument

插入最后一个参数,

比如我 运行 $ cd /

那么我执行“ Esc . ”, 就会插入 "/ " 这个参数

# Ctrl B - Move back a character

# Ctrl F - Move forward a character

将光标向前|后移动一个字母的距离,不改变任何东西。

下面不常用

# Ctrl x @ - Show possible hostname completions(完成)

# Alt

# Alt > - Move to the last line in the history

# Alt ? - Show current completion list

# Alt * - Insert all possible completions

# Alt / - Attempt to complete filename

# Alt . - Yank last argument to previous command

# Alt c - Capitalize the word

# Alt l - Make word lowercase

# Alt n - Search the history forwards non-incremental

# Alt p - Search the history backwards non-incremental

# Alt r - Recall command

# Alt t - Move words around

# Alt u - Make word uppercase

# Alt back-space - Delete backward from cursor

# Here "2T" means Press TAB twice

# $ 2T - All available commands(common)

# $ (string) 2T - All available commands starting with (string)

# $ /2T - Entire directory structure including Hidden one

# $ 2T - Only Sub Dirs inside including Hidden one

# $ *2T - Only Sub Dirs inside without Hidden one

# $ ~2T - All Present Users on system from "/etc/passwd"

# $ $2T - All Sys variables

# $ @2T - Entries from "/etc/hosts"

# $ =2T - Output like ls or dir

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值