Ctrl+A- Move the cursor to the beginning of the line.Ctrl+E- Move the cursor to the end of the line.Ctrl+B- Move the cursor backward one character (left).Ctrl+F- Move the cursor forward one character (right).Alt+B- Move the cursor backward one word.Alt+F- Move the cursor forward one word.
Ctrl+U- Cut (delete) everything from the cursor to the beginning of the line.Ctrl+K- Cut (delete) everything from the cursor to the end of the line.Ctrl+W- Cut (delete) the word before the cursor.Ctrl+Y- Paste (yank) the last thing you cut (works withCtrl+U,Ctrl+K, orCtrl+W).Ctrl+D- Delete the character under the cursor.Ctrl+T- Swap (transpose) the character under the cursor with the one before it.
Ctrl+P- Scroll up through your command history (same as the up arrow).Ctrl+N- Scroll down through your command history (same as the down arrow).Ctrl+R- Search your command history interactively. Type a few letters, and it’ll show matching commands. PressCtrl+Ragain to cycle through matches, orEnterto run the selected command.Alt+.- Insert the last argument from the previous command (e.g., if you ranls dir_name, this pastesdir_name).
Ctrl+C- Terminate (kill) the currently running command.Ctrl+Z- Suspend the currently running command (put it in the background). Usefgto bring it back orbgto let it run in the background.Ctrl+D- Exit the terminal or shell session (when the line is empty; otherwise, it deletes a character).
Ctrl+L- Clear the screen (same as typingclear, but faster).Tab- Auto-complete commands, filenames, or paths. Double-tapTabto see all possible completions if ambiguous.Ctrl+_- Undo the last edit you made to the command line (handy if you accidentally delete something).
- Combine these! For example,
Ctrl+AthenCtrl+Kdeletes the entire line quickly. - If you mess up a command,
Ctrl+Uclears it from the cursor back, letting you start over. - Use
Ctrl+Rfor history searches—it’s a game-changer when you can’t remember a long command you ran earlier.