- My top 10 terminal shortcuts for Linux
- More Linux resources
- 1. Tab
- 2. Ctrl+C
- 3. Ctrl+R/O/G
- 4. Ctrl+L
- 5. Ctrl+D
- 6. Ctrl+Alt+D
- 7. Ctrl+U
- 8. Ctrl+Z
- 9. Ctrl+A
- 10. Ctrl+E
- Bonus tip
- Wrap up
- Горячие клавиши терминала Linux
- Горячие клавиши терминала Linux
- 1. Tab
- 2. Ctrl + R
- 3. Ctrl + C
- 4. Ctrl + Z
- 5. Ctrl + D
- 6. Ctrl + L
- 7. Ctrl+P и Ctrl+N
- 8. Ctrl + A и Ctrl + E
- 10. Ctrl + W
- 11. Ctrl + Y
- 12. Ctrl + B и Ctrl + F
- 13. Ctrl + T
- 14. Ctrl +X затем Ctrl + E
- 15. Alt +.
- 16. Alt + B и Alt + F
- 17. Alt + C, Alt + L и Alt + U
- 18. Ctrl + S и Ctrl + Q
- Сочетания клавиш эмулятора терминала
- 1. Ctrl + Alt + T
- 2. Ctrl + Shift + С и Ctrl + Shift + V
- 3. Ctrl + Shift + F
- 4. Shift + ЛКМ и Shift + ПКМ
- Выводы
- 13 Linux Terminal Shortcuts Every Power Linux User Must Know
- Must Know Linux Shortcuts
- 1. Tab
- 2. Ctrl + C
- 3. Ctrl + Z
- 4. Ctrl + D
- 5. Ctrl + L
- 6. Ctrl + A
- 7. Ctrl + E
- 8. Ctrl + U
- 9. Ctrl + K
- 10. Ctrl + W
- 11. Ctrl + Y
- 12. Ctrl + P
- 13. Ctrl + N
- Bonus shortcut: Ctrl + R to search in command history
- What’s your favorite Linux terminal shortcut?
My top 10 terminal shortcuts for Linux
Image by Pixabay
More Linux resources
Linux is so flexible that you often can achieve the same results in several different ways. What sets sysadmins apart is how we use this flexibility to achieve the desired outcome. One of the joys we all share is our daily interaction with Linux terminals and the command line. Evidently, terminals and command lines play a significant role in almost every Linux admin’s life.
Commands can get tricky at times and really frustrating when you have the right skills, but your brain starts thinking faster than what your keyboard and mouse can do for you.
What can you do to simplify your interaction with Linux so that you can accomplish much more every day? The most straightforward, yet practical solution is utilizing shortcuts. Shortcuts can significantly improve your skills and save you several days every year, according to recent studies. So now you may be asking yourself, “What are the most popular and frequently-used Linux shortcuts out there?”
Well, ask no more! In this article, I share my top 10 terminal shortcuts that I believe are useful to the broadest range of the sysadmin community. They are a vital part of my life and allow me to save time and focus better on what I enjoy doing: Building systems. I also provide a quick tip at the end to help you master any Linux shortcuts.
But wait, what are shortcuts?
Shortcuts are a key or combination of keys that provide quick access to a specific task or command. Almost everyone uses computer shortcuts in some form or fashion, but they are particularly critical for Linux sysadmins.
Just a note, most of these tricks assume you’re using a Bash shell. They may be similar in other shells, but be aware there could be subtle differences.
1. Tab
Tab is my ultimate friend — it never lets me down. It is the handiest shortcut and time saver ever developed. It autocompletes commands, file names, or directory names for you. Simply start typing a command, file name, or directory name, and then press the Tab key. The system will either complete the string or display all available options to you.
2. Ctrl+C
Ctrl+C is a well-known shortcut that I use all the time. It cleanly aborts most programs by sending the SIGINT signal to the program that I want to interrupt and abort. Most programs correctly catch it and exit cleanly. If the program does not specify how to handle SIGINT, the underlying processes are then self-terminated. Yes, it’s safe to use.
3. Ctrl+R/O/G
I find this combination (reverse-i-search) very useful when searching through my command history. I can bring up commands that I used previously, navigate through them, and repeat the command I need. This is very helpful with long and chained commands.
- Ctrl+R: Recall the last command matching the characters you provide.
- Ctrl+R (again): Navigate through the matching commands.
- Ctrl+O: Send the command back to your terminal or select Enter to execute the command from the search mode.
- Ctrl+G: Leave the history search mode without running a command.
4. Ctrl+L
This shortcut is equivalent to the clear command. It clears your terminal screen.
5. Ctrl+D
This shortcut will effectively log you out of any terminal and close it, or get you back to the original user when used after su or sudo commands. It sends an EOF (End-of-file) marker to bash. Bash exits when it receives this marker. This shortcut is similar to running the exit command.
6. Ctrl+Alt+D
This shortcut will minimize all terminals/windows and show your desktop. Repeat it to revert your windows back in the same order.
7. Ctrl+U
This shortcut erases everything from the current cursor position to the beginning of the line. I find this useful when I mistype a command or see a syntax error and prefer to start over. It’s a very handy shortcut.
8. Ctrl+Z
This shortcut is useful if you need to get the terminal back while working on something. It sends the SIGTSTP signal to the foreground process. For example, you are working in a text editor and need to break out to find some data. You can use this shortcut to suspend and send the editor to the background, do your other task, and then run fg to get back into your application.
9. Ctrl+A
Move the cursor to the beginning of the line. Very handy when you need that little flag added to the beginning of your 200 characters chained-command. I use this instead of the arrow keys to save time.
10. Ctrl+E
This shortcut does the opposite of Ctrl+A. It moves the cursor to the end of the line. I always use the Ctrl+A and Ctrl+E shortcuts to quickly move my cursor around the current line while typing long or chained commands.
Bonus tip
You now have my top 10 list and a good idea of how shortcuts can improve your sysadmin skills and overall productivity. Now, how are you going to memorize them?
One of the best ways I found to learn Linux shortcuts is to choose a couple of shortcuts, write them on a Post-it note, and stick it to my screen. I keep the Post-it there until I have learned the shortcuts by heart. I then change to another note that contains new shortcuts.
Wrap up
It takes time to develop quality Linux skills. I know I didn’t have them all when I started with Linux two decades ago. Learning this handful of shortcuts will help shine as a Linux pro and earn you serious bragging rights in the Linux community.
Источник
Горячие клавиши терминала Linux
Терминал — один из самых мощных инструментов Linux. С помощью него можно настроить и сделать практически всё в этой операционной системе. Чтобы сделать работу в терминале ещё более удобной и продуктивной разработчики добавили различные сочетания клавиш.
В этой статье мы собрали самые полезные горячие клавиши терминала Linux, которые могут пригодится вам в работе. Здесь есть комбинации клавиш для навигации по истории команд, коррекции ошибок и управления окном терминала. Все клавиши расположены в случайном порядке.
Горячие клавиши терминала Linux
1. Tab
Без этого сочетания терминалом пользоваться невозможно, и поэтому его знают все. Одно нажатие клавиши Tab автоматически дополняет текущую команду или путь к файлу если возможен только один вариант. Два нажатия по ряд показывают возможные варианты автодополнения. Это делает набор команд и путей к файлам намного быстрее.
2. Ctrl + R
После нажатия Ctrl+R появляется строка поиска в которой вы можете начать вводить имя команды, которую надо выполнить. Система найдёт все команды, которые ранее выполнялись с таким началом и отобразит самую свежую. Вы можете уточнить поиск добавив ещё несколько символов. Для выполнения команды просто нажмите Enter, для редактирования Esc.
3. Ctrl + C
Это сочетание клавиш позволяет прервать работу любой программы, которая выполняется в терминале. После нажатия Ctr + C программе отправляется сигнал SIGINT и если она не обрабатывает его особым образом выполнение программы завершается. Некоторые программы перехватывают сигнал и перед завершением выполняют кое какие действия по сохранению данных и завершению операций, например пакетный менеджер zypper.
4. Ctrl + Z
С помощью Ctrl+Z вы можете перевести текущую программу в фоновый режим. Обычно, если вам надо чтобы программа выполнялась в фоновом режиме просто добавьте символ & после команды. Но если вы забыли это сделать поможет это сочетание клавиш. Чтобы посмотреть задачи, которые сейчас работают в фоне используйте команду jobs, а для возврата задачи в нормальный режим — команду fg.
5. Ctrl + D
Сочетание клавиш Ctrl+D можно считать альтернативой команды exit. Если вы подключены по SSH то сессия будет разорвана. Если вы работаете в терминале напрямую, то окно будет закрыто.
6. Ctrl + L
Альтернатива команды clear. Позволяет очистить вывод терминала. Очень удобно для создания снимков экрана и просто для очистки лишней информации.
7. Ctrl+P и Ctrl+N
Эти сочетания клавиш альтернативы клавишам стрелки вверх и вниз. Первое показывает предыдущую введенную команду, а второе следующую. Так вы можете перемещаться по истории команд. Это не удобнее стрелок, но иногда может быть полезно.
8. Ctrl + A и Ctrl + E
Перемещаться можно не только по истории команд, но и по текущей строке. Эти горячие клавиши — аналоги клавиш Home и End. Первая комбинация перемещает курсор в начало строи, а вторая в конец.
9. Ctrl + U и Ctrl + K
С помощью первого сочетания можно удалить весь текст от начала строки до позиции курсора, а с помощью второго — от позиции курсора и до конца строки. Это может быть полезно если вы ввели неверную команду и не хотите стирать её по одному символу.
10. Ctrl + W
Нажав Ctrl+W вы можете стереть слово перед курсором. Если курсор находится в середине слова, то будут стёрты все символы от курсора до начала слова. Удобнее всего ставить курсор после слова, которое нужно убрать.
11. Ctrl + Y
С помощью Ctrl + Y вы можете вставить текст вырезанный с помощью Ctrl + U, Ctrl + K и Ctrl + W. Текст будет вставлен туда, где находится курсор.
12. Ctrl + B и Ctrl + F
Аналог для клавиш стрелка вправо и стрелка влево. Первое сочетание позволяет перемещаться на один символ вправо, а второе на один символ влево.
13. Ctrl + T
Заменяет символ, находящийся под курсором на предыдущий символ. Или перемещает символ перед курсором к концу строки.
14. Ctrl +X затем Ctrl + E
Открывает текущую команду в текстовом редакторе. Если в переменной EDITOR редактор не задан, то будет использоваться nano. После редактирования и сохранения результата команда будет выполнена. Удобно для написания многострочных скриптов.
15. Alt +.
Аналог команды $!. Позволяет вставить последний аргумент предыдущей команды в позицию курсора. Удобно, если надо выполнить несколько команд с одинаковым аргументом.
16. Alt + B и Alt + F
Эти сочетания позволяют перемещаться по словам, также как их аналоги с Ctrl по символам. Alt + B перемещает курсор на слово влево, а Alt+F на слово вправо.
17. Alt + C, Alt + L и Alt + U
Следующие три сочетания клавиш позволяют играть с регистром символов команды. Первое сочетание — Alt + C делает символ под курсором прописным, а все остальные буквы до конца слова строчными. Alt + L делает все буквы до конца слова строчными, а Alt + U — прописными.
18. Ctrl + S и Ctrl + Q
Если команда выводит информацию слишком быстро, а вам надо прочитать её или скопировать, можно попросить терминал поставить на паузу вывод команды. Для этого нажмите Ctrl +S. Чтобы вернуть всё обратно нажмите Ctrl + Q.
Сочетания клавиш эмулятора терминала
Все сочетания клавиш, перечисленные выше будут работать во всех терминалах и эмуляторах терминала, которые используют командную оболочку Bash или другую популярную оболочку. Но у популярных эмуляторов терминала есть свои горячие клавиши, которые могут вам очень сильно пригодится при работе. Давайте рассмотрим их тоже. В этой статье будут использоваться горячие клавиши из Gnome Terminal, но в других терминалах они похожи.
1. Ctrl + Alt + T
С помощью этого сочетания клавиш можно открыть терминал в большинстве дистрибутивов, основанных на Ubuntu и Debian. Это просто, быстро и удобно.
2. Ctrl + Shift + С и Ctrl + Shift + V
Копирование и вставка — очень важные функции операционной системы. Сочетание клавиш Ctrl + C просто не может работать для копирования, потому что оно используется для завершения команды, поэтому для копирования и вставки была добавлена клавиша Shift.
3. Ctrl + Shift + F
Если вам надо выполнить поиск по выводу в терминале можно воспользоваться сочетанием Ctrl + Shift + F. После нажатия откроется окно ввода, в котором вы можете ввести искомое слово.
4. Shift + ЛКМ и Shift + ПКМ
Здесь ЛКМ и ПКМ — это правая и левая кнопка мышки. Такие программы, как screen и tmux в режиме поддержки работы мышью захватывают контроль мышки и вяжут на неё свои функции. Таким образом обычное копирование и вставка могут стать проблемой. Чтобы этого избежать можно выделять текст сочетанием клавиш Shift + ЛКМ и открывать контекстное меню с помощью Shift + ПКМ.
Выводы
В этой статье мы собрали лучшие сочетания клавиш терминала Linux, которые могут пригодится вам в работе с системой или во время её настройки. А какие горячие клавиши нравятся вам? Какие вы используете? Напишите в комментариях!
Источник
13 Linux Terminal Shortcuts Every Power Linux User Must Know
You know what sets apart a pro user from a regular user? Mastery over the keyboard shortcuts.
Alright! That’s not the only thing but it is undoubtedly a factor.
Shortcuts help you to be more productive and efficient with whatever tool you use. Just think about it. If someone holds the mouse all the way down to copy entire text instead of Ctrl+A, how would you feel about it?
Linux terminal is not an exception. There are certain Linux terminal shortcuts that every user must know and practice.
Trust me; once you master these shortcuts, you’ll notice how good you are with using the Linux command line.
Must Know Linux Shortcuts
I would like to mention that some of these shortcuts may depend upon the Shell you are using. Bash is the most popular shell, so the list is focused on Bash. If you want, you may call it Bash shortcut list as well.
1. Tab
This is the Linux shortcut you cannot live without. It will save you so much time in the Linux command line.
Just start typing a command, filename, directory name or even command options and hit the tab key. It will either automatically complete what you were typing or it will show all the possible results for you.
If you could only remember one shortcut, this would be the chosen one.
2. Ctrl + C
These are the keys you should press in order to break out of a command or process on a terminal. This will stop a running program immediately.
If you want to stop using a program running in the foreground, just press this key combination.
3. Ctrl + Z
This shortcut will send a running program in the background. Normally, you can achieve this before running the program using the & option but if you forgot to do that, use this key combination.
4. Ctrl + D
This keyboard shortcut will log you out of the current terminal. If you are using an SSH connection, it will be closed. If you are using a terminal directly, the application will be closed immediately.
Consider it equivalent to the ‘exit’ command.
5. Ctrl + L
How do you clear your terminal screen? I guess using the clear command.
Instead of writing C-L-E-A-R, you can simply use Ctrl+L to clear the terminal. Handy, isn’t it?
6. Ctrl + A
This shortcut will move the cursor to the beginning of the line.
Suppose you typed a long command or path in the terminal and you want to go to the beginning of it, using the arrow key to move the cursor will take plenty of time. Do note that you cannot use the mouse to move the cursor to the beginning of the line.
This is where Ctrl+A saves the day.
7. Ctrl + E
This shortcut is sort of opposite to Ctrl+A. Ctrl+A sends the cursor to the beginning of the line whereas Ctrl+E moves the cursor to the end of the line.
Note: If you have the Home and End keys on your keyboard, you can also use them. Home is equivalent to Ctrl +A and End is equivalent to Ctrl + E.
8. Ctrl + U
Typed a wrong command? Instead of using the backspace to discard the current command, use Ctrl+U shortcut in the Linux terminal. This shortcut erases everything from the current cursor position to the beginning of the line.
9. Ctrl + K
This one is similar to the Ctrl+U shortcut. The only difference is that instead of the beginning of the line, it erases everything from the current cursor position to the end of the line.
10. Ctrl + W
You just learned about erasing text till the beginning and the end of the line. But what if you just need to delete a single word? Use the Ctrl+W shortcut.
Using Ctrl+W shortcut, you can erase the word preceding to the cursor position. If the cursor is on a word itself, it will erase all letters from the cursor position to the beginning of the word.
The best way to use it to move the cursor to the next space after the targetted word and then use the Ctrl+W keyboard shortcut.
11. Ctrl + Y
This will paste the erased text that you saw with Ctrl + W, Ctrl + U and Ctrl + K shortcuts. Comes handy in case you erased wrong text or if you need to use the erased text someplace else.
12. Ctrl + P
You can use this shortcut to view the previous command. You can press it repeatedly to keep on going back in the command history. In a lot of terminals, the same can be achieved with PgUp key.
13. Ctrl + N
You can use this shortcut in conjugation with Ctrl+P. Ctrl+N displays the next command. If you are viewing previous commands with Ctrl+P, you can use Ctrl+N to navigate back and forth. Many terminals have this shortcut mapped to the PgDn key.
Bonus shortcut: Ctrl + R to search in command history
You typed some command but cannot remember what it was exactly? Meet Ctrl + R.
This keyboard shortcut allows you to perform a search in your command history. Just press Ctrl+R and start typing. It will show the last command that matches the string you typed. Note that the typed string could be anywhere in the command. How cool is that?
If you want to see more commands for the same string, just keep pressing Ctrl + R.
You can press enter to run the command selected or press Esc to come out of the search with the last search result.
Try it and be amazed.
What’s your favorite Linux terminal shortcut?
If you would like to learn a few more Linux terminal tricks, you may watch this video to unearth hidden command line gems:
I have shared my favorite terminal shortcuts. What are some of your favorite Linux shortcuts? If you have one (or more), why not share it with the rest of us in the comment section?
Источник