Even as you become more skilled with Terminal, it’s not the most user-friendly application on Earth. Because it’s a text-only input method, it’s hyper fast, but it can also be hyper confusing. If you spend a lot of time there, you might want to find ways to make it slightly less painful to get your work done. Here’s a couple of Terminal tips to make our Terminal interactions a little more user-friendly.
Terminal Tips: Keyboard Shortcuts
If, like every computer user I know, you’re used to doing everything with a mouse, moving around the Terminal window stinks. It’s counter-intuitive and old-fashioned to to move around solely with the arrow keys, and that puts a lot of people off the idea of using Terminal. There’s a bunch of useful keyboard shortcuts that can shuttle you around the command line, though. Once you get them under your fingertips, you’ll actually be able to move faster with them than you would with a mouse.
Control + A: Move your cursor to the beginning of the command prompt.
Control + E: Move your cursor to the beginning of the end prompt.
Control + U: Clear the entire line so you can type in a completely new command.
Control + K: Delete all the characters from the position of the cursor to the end of the line.
Control + W: Delete the word behind (to the left of) the cursor only.
Alt + B: Back (left) one word. You can also use use Option+Right-Arrow
Alt + F: Forward (right) one word. You can also use use Option+Left-Arrow
Terminal Tips: Customizing Terminal’s Display
You can make Terminal look a heck of a lot cooler by customizing its appearance. You can use the built-in sets or specifying your own personal theme, and switch between them at will.
1. Open Terminal and navigate to Preferences.
2. Click the Profiles tab in the top menu bar.
3. In this window, we can see the visual appearance of our Terminal window. There’s a few presets on the left you can select, or you can make your own changes in the options below.
4. When you’re done selecting a new profile, be sure to click the “Default” button to make the profile apply to all newly-opened Terminal windows.
5. If you made changes and you want to save your own personal profile, you can do so by clicking the “plus” button under the list of profiles.
Other Terminal Tips for Easy Interaction
clear command “erases” everything in your current Terminal window by automatically scrolling past it. The commands still exist in the session, but they’ll be removed from view to stop cluttering up your window.
2. If you want to quickly move your cursor to a specific point in the command line, hold the Option key and click on that cursor position. When you’ve done it properly, the mouse cursor will become a crosshair and the Terminal cursor will be transported to the clicked location.
3. Terminal can “auto-complete” certain inputs for you. If you’re typing the name of a directory, press the “Tab” key to ask Terminal to autocomplete the rest of the current folder or file name. It won’t work if there’s multiple files or folders that can be valid completions, and it only goes one directory deep at a time. However, it will save you a heck of a lot of trouble trying to perfectly type in file names and path.
4. Don’t forget to use the tilde ( ~ ) to indicate your home directory. You can use this as part of file paths, as well as input for commands.
5. You can drag and drop files into Terminal to get their properly-formatted, fully-qualified paths. For example, if you have a directory open in Finder and you want to get to the same directory in Terminal, type in
cd then drag the folder from your Finder window into your Terminal window. The file path will be automatically added, and you just need to press Enter.
6. If you get lost, use the
pwd command to get your present working directory.
7. If you’re trying to find a command to accomplish a specific task, use the
apropos command to search all man pages for a particular keyword. To get a quick, one-line summary of a command you’re already familiar with, use the
whatis command followed by the command name.
8. Even though you don’t have access to standard text manipulation with the mouse, you can still copy and make text in Terminal. Use your mouse to select text, then use Command + C to copy and Command + V to paste.
9. Cycle through previously entered commands by hitting the Up arrow key. Reverse the cycling by pressing the Down arrow key.
10. Run the previously-entered command with sudo by using the command
You might also like the following: