5 ways to navigate the Linux terminal faster (2024)

Image

5 ways to navigate the Linux terminal faster (1)

One of the advantages of working in a terminal is that it's faster than most other interfaces. Thanks to the GNU Readlinelibrary and the built-in syntax of shells like Bash and Zsh, there are several ways to make your interactions with the command line even faster. Here are five ways to make the most of your time in the terminal.

Skip to bottom of list

1. Navigate without the arrow keys

While executing commands on the command line, sometimes you miss a part at the beginning or forget to add certain tags or arguments toward the end. It's common for users to use the Left and Right arrow keys on the keyboard to move through a command to make edits.

There's a better way to get around the command line. You can move the cursor to the beginning of the line with CTRL+A. Similarly, use CTRL+E to move the cursor to the end of the line. Alt+F moves one word forward, and Alt+B moves one word back.

Shortcuts:

  • Instead ofLeft arrow, left, left, left, useCTRL+A to go to the start of the lineor Alt+B to move back one word.
  • Instead ofRight arrow, right, right, right, useCTRL+E to move to the end of the line, or Alt+F to move forward a word.

[ Download asysadmin's guide to Bash scripting. ]

2. Don't use the backspace or delete keys

It's not uncommon to misspell commands. You might be used to using the Backspace key on the keyboard to delete characters in the backward direction and the Delete button to delete them in the forward direction. You can also do this task more efficiently and easily with some helpful keyboard shortcuts.

[ Want to test your sysadmin skills? Take a skills assessment today. ]

Instead of deleting commands character by character, you can delete everything from the current cursor position to the beginning of the line or the end.

Use CTRL+U to erase everything from the current cursor position to the beginning of the line. Similarly, CTRL+K erases everything from the current cursor position to the end of the line.

Shortcuts:

  • Instead ofBackspace, useCTRL+U.
  • Instead ofDelete, useCTRL+K.

Skip to the bottom of list

Image

Download now

3. Execute multiple commands in a single line

Sometimes it's convenient to execute multiple commands in one go, letting a series of commands run while you step away from your computer or turn your attention to something else.

For example, I love contributing toopen source, which means working with Git repositories. I find myself running these three commands frequently:

$ git add$ git commit -m "message"$ git push origin main

Instead of running these commands in three different lines, I use a semi-colon (;) to concatenate them onto a single line and then execute them in sequence.

Shortcuts:

  • Instead of:
    $ git add .$ git commit -m "message"$ git push origin main
    Use:
    $ git add .;git commit -m "message";git push origin main
  • Use the ; symbol to concatenate and execute any number of commands in a single line. To stop the sequence of commands when one fails, use && instead:
    $ git add . && git commit -m "message" && git push origin main

4. Alias frequently used commands

You probably run some commands often. Sometimes, these may be lengthy commands or a combination of different commands with the same arguments.

[ Learn how to install applications on Linux. ]

To save myself from retyping these types of commands, I create an alias for the commands I use most frequently. For example, I often contribute to projects stored in a Git repository. Since I use the git push origin main command numerous times daily, I created an alias for it.

To create an alias, open your .bashrc file in your favorite editor and add an alias:

alias gpom= "git push origin main"

Try creating an alias for anything you run regularly.

Note: The .bashrc file is for users using the Bash shell. If your system runs a different shell, you probably need to adjust the configuration file you use and possibly the syntax of the alias command. You can check the name of the default shell in your system with the echo $SHELL command.

[ Keep your favorite Git commands, aliases, and tips close at hand. Download the Git cheat sheet. ]

After creating the alias, reload your configuration:

$ . ~/.bashrc

And then try your new command:

$ gpom

Shortcut:

Instead of typing the original command, such as:

$ git push origin main

Create an alias with the alias declaration in .bashrc or your shell's configuration file.

Skip to bottom of list

5. Search and run a previous command without using the arrow keys

Most terminal users tend to reuse previously executed commands. You might have learned to use the Up arrow button on your keyboard to navigate your shell's history. But when the command you want to reuse is several lines in the past, you must press the Up arrow repeatedly until you find the command you are looking for.

Typically the situation goes like this:Up arrow, up, up, up. Oh, I found it! Enter.

There is an easier way:You can search your history one step at a time using the history command.

When you use the history command, the list of commands appears with a number beside each. These numbers are known as the history-number of the command. You can type !{history-number} on your terminal to run the command of the corresponding number.

Shortcuts:

  • Instead ofUp arrow, up, up, up, Enter,typehistory, and then look for the history-number of the command you want to run:
    $ !{history-number}
  • You can also perform this task a different way: Instead of:Up arrow, up, up, up, Enter, useCTRL+R and type the first few letters of the command you want to repeat.

Command-line shortcuts

Shortcut keys provide an easier and quicker method of navigating and executing commands in the shell. Knowing the little tips and tricks can make your day less hectic and speed up your work on the command line.

[ Keep your most commonly used commands handy with the Linux commands cheat sheet. ]

Topics: Command line utilities Linux

5 ways to navigate the Linux terminal faster (2024)

FAQs

5 ways to navigate the Linux terminal faster? ›

Alt+F moves one word forward, and Alt+B moves one word back. Shortcuts: Instead of Left arrow, left, left, left, use CTRL+A to go to the start of the line or Alt+B to move back one word. Instead of Right arrow, right, right, right, use CTRL+E to move to the end of the line, or Alt+F to move forward a word.

How do I navigate more in Linux? ›

How to Use More Command in Linux
  1. To move forward one page, press the spacebar or the "f" key.
  2. To move backward one page, press the "b" key.
  3. To move forward one line, press the "Enter" key.
  4. To quit more commands, press the "q" key.
May 3, 2023

How do you quick open the terminal in Linux? ›

The shortcut is to press CTRL + ALT + T simultaneously to open the terminal at a glance on your Linux Screen.

What is the fastest search command in Linux? ›

Locate Command Syntax

The locate command is a useful alternative, as it is faster than the find command when performing searches. That's because the former only scans your Linux database instead of the whole system.

How do you navigate up in Linux? ›

For most users, you should be able to scroll up and down, one line at a time using Shift+UpArrow or Shift+DownArrow. To jump an entire page at a time, try Shift+PageUp or Shift+PageDown. If these commands don't work, it's likely your terminal is using different keybindings.

How to navigate fast in terminal? ›

Navigate without the arrow keys

There's a better way to get around the command line. You can move the cursor to the beginning of the line with CTRL+A. Similarly, use CTRL+E to move the cursor to the end of the line. Alt+F moves one word forward, and Alt+B moves one word back.

How can I speed up Linux? ›

How to Improve Boot Speed of Linux
  1. Overview. In this tutorial, we'll dive into the details of how to improve the boot speed of Linux. ...
  2. Analyzing the Boot Time. ...
  3. Disabling Services and Daemons. ...
  4. Optimizing Disk Usage. ...
  5. Kernel and Driver Optimization. ...
  6. Utilizing Bootloaders. ...
  7. Enabling Fastboot. ...
  8. Updating System Regularly.
Mar 18, 2024

What is the top 1 command in Linux? ›

linux - top (1) top provides an ongoing look at processor activity in real time. It displays a listing of the most CPU-intensive tasks on the system, and can provide an interactive inter- face for manipulating processes. d Specifies the delay between screen updates.

What is the most fastest Linux? ›

  • 1 – Ubuntu. Ubuntu is a comprehensive operating system that combines advanced features, high performance, and a user-friendly design suitable for both personal use and professional development. ...
  • 2 – Fedora. ...
  • 3 – Pop!_OS. ...
  • 4 – Manjaro. ...
  • 5 – Kali Linux. ...
  • 6 – Linux Mint. ...
  • 7 – Alma Linux. ...
  • 8 – Rocky Linux.
Jul 17, 2024

How do you navigate up in command line? ›

Type cd.. to go up/back one directory. If you're in the Desktop folder, for instance, entering this command will jump you back to the user's folder. If you feel lost within the directory, the dir command lists all the items contained in that folder. Type cd\ to jump all the way to the root of the hard drive.

How to navigate to a directory in terminal? ›

The cd command allows you to move between directories. The cd command takes an argument, usually the name of the folder you want to move to, so the full command is cd your-directory . Now that we moved to your Desktop, you can type ls again, then cd into it.

How do I navigate to a user in Linux? ›

The su command in Linux lets you switch to another user's account or execute commands as a different user. It's useful for administrative tasks that require elevated privileges. su is also used to test commands with different user permissions to ensure the system requires authentication for user switches.

How to scroll more in Linux? ›

Following are some key combinations that are useful in scrolling through the Linux terminal.
  1. Ctrl+End: This allows you to scroll down to your cursor.
  2. Ctrl+Page Up: This key combination lets you scroll up by one page.
  3. Ctrl+Page Dn: This lets you scroll down by one page.
Apr 28, 2022

How to search using more in Linux? ›

To search within more press the / key followed by the phrase to be searched for. The search pattern accepts regular expressions. The following searches for the phrase 'eat'. This will search lines for instances of the phrases and scroll the page to the first occurrence.

How do you jump to the line in more command? ›

Navigating Through Text Files Using the 'more' Command

While viewing text files with 'more', you can use the following controls for navigation: Enter key: Scrolls down one line at a time. Space bar: Moves to the next page or screen. 'b' key: Goes back one page.

Top Articles
¿Qué es y qué funciones cumple un Servidor de Impresión? - Verbok
Reasons Why You Should Study Management 
Katie Pavlich Bikini Photos
Gamevault Agent
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Free Atm For Emerald Card Near Me
Craigslist Mexico Cancun
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Select Truck Greensboro
Things To Do In Atlanta Tomorrow Night
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Craigslist In Flagstaff
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Testberichte zu E-Bikes & Fahrrädern von PROPHETE.
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Walgreens Alma School And Dynamite
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Dmv In Anoka
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
Rogold Extension
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Weekly Math Review Q4 3
Facebook Marketplace Marrero La
Nobodyhome.tv Reddit
Topos De Bolos Engraçados
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hampton In And Suites Near Me
Stoughton Commuter Rail Schedule
Bedbathandbeyond Flemington Nj
Free Carnival-themed Google Slides & PowerPoint templates
Otter Bustr
Selly Medaline
Latest Posts
Article information

Author: Van Hayes

Last Updated:

Views: 5710

Rating: 4.6 / 5 (66 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Van Hayes

Birthday: 1994-06-07

Address: 2004 Kling Rapid, New Destiny, MT 64658-2367

Phone: +512425013758

Job: National Farming Director

Hobby: Reading, Polo, Genealogy, amateur radio, Scouting, Stand-up comedy, Cryptography

Introduction: My name is Van Hayes, I am a thankful, friendly, smiling, calm, powerful, fine, enthusiastic person who loves writing and wants to share my knowledge and understanding with you.