Jump to content
  • 2 tricks that make using the Linux command line a lot easier

    aum

    • 211 views
    • 4 minutes
     Share


    • 211 views
    • 4 minutes

    Using the Linux command line doesn't have to be the chore you think it is.

     

    One of the myths surrounding the Linux operating system is that you have to run all sorts of complicated commands to get anything done. Although that may have been the case some time ago, it's no longer a reality.

     

    You could go your entire life with Linux and never run a single command. That's how far the Linux desktop has come over the years.

    Also: The first 5 Linux commands every new user should learn

     

    However, for some users, the power offered by the Linux CLI (Command Line Interface) can be enticing. And, as someone who's used Linux for decades, I still revert back to the command line for certain things.

     

    That's because the CLI can be really efficient. Case in point, there are two features you should know about that make using the Linux command line even easier: Tab completion and history. Let me explain each of these.


    How to use tab completion

     

    What you'll need: The only thing you'll need for this is a running instance of Linux. It doesn't matter what distribution you use because both of these features are found in all flavors of the open-source operating system.

     

    Let's say you know there's a command you need to run but can't remember its name. You know it starts with sys, but that's all you can remember.


    1. Open your terminal window

     

    Once your terminal window is open, type sys and hit Tab on your keyboard. You should then see all commands on your system that start with sys.

     

    Look through the list until you find the command you need.

     

    tabcomplete1.jpg?auto=webp&width=1280

    Trying to remember the systemctl command is easier with tab completion.
    Screenshot by Jack Wallen/ZDNET


    2. Type some more

     

    Even better, you don't have to type out the entire command. Say, for example, the command you were looking for was systemctl. You could type systemc, hit Tab, and the remainder of the command will be automatically filled out.

     

    This little trick works better if there aren't as many commands that start with system (because to get it to work for systemctl you have to type all but the final two letters. For example, if you use Samba (for folder shares across your network), you could type smbc and hit Tab to have the entire smbcontrol command completed for you.


    How to use command history


    1. Scroll through your command history

     

    Do you remember the last command you typed? If it was a complicated command, you might not want to have to type it again. To avoid that, open your terminal window and hit the up arrow on your keyboard. What you should see is the last command you ran. Hit the up arrow again and you'll see the command before that. Keep hitting the up arrow on your keyboard and you'll go through the entire saved history of the commands you've issued.


    2. Run a command from your history

     

    When you find the command you want to run, stop on it and hit Enter on your keyboard. That command will run as though you just typed it. This trick comes in very handy when you either don't feel like typing complicated commands or you can't remember the exact command you'd previously run.

     

    To this day, I use both of these tricks with Linux and they never fail to make using the command line a bit easier. Once you start using these handy helpers, you'll be less fearful of using the Linux CLI.

     

    Source


    User Feedback

    Recommended Comments

    There are no comments to display.



    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...