Become a Linux Command Line Master With These Tips and Tricks

Moe Long 15-11-2017

For Linux users, the command line is an essentially, and ultra-powerful tool. While more user-friendly Linux operating systems (OS) offer loads of functionality without the need for entering the terminal, it’s a necessary element of the OS. Contrary to popular opinion, the command line can even simplify certain actions.


Whether you’re brand new to Linux distros, or a seasoned Linux veteran, the command line offers a bevy of uses. Try these tips for mastering the command line.

Files and Folders

Image Credit: ProSmile via Pixabay

Although you can easily create, move, and navigate between folders with a graphical user interface (GUI), the command line is perfectly capable of handling files and folders.

Change Directory

Changing directories is pretty simple. In a terminal, enter:


For instance, to navigate into a specific folder like the Downloads folder on your harddrive, merely enter the path to your desired directory:

cd /home/user/Downloads

Changing directories is incredibly beneficial when installing software via the command line. To run an installer using the terminal, you’ll first need to change into the folder where that installer resides.

Make Directory

In addition to switching folders, the command line allows for folder creation. You can make a directory by running the command:


Therefore, to make a folder called Apps, you would enter:

mkdir Apps

But this makes a folder in the current directory. If you want to specify where a directory is created, you’ll either need to change directory into that folder, or enter the full path:

mkdir /home/user/Documents/Apps

If there aren’t folders for the full path, running this command creates directories for all of the folders in the path.


An oft-used command when handling files and folders is copy:


To copy a file into another file, run:


Alternately, you can copy files into directories using this command:



Like copying files and folders, you can move items with the terminal. That command is:


When moving the content of one file to another, run:


However, if the second file doesn’t exist, the first file is renamed as the second file. But if the second file does exist, then its contents are replaced with those of the first file.You can also use the move command with directories:


Similar to how the move command handles files, if the second directory does not exist then the first directory is simply renamed. Yet if the second directory does exist, the contents of the first directory are moved into the second directory.



Want to remove files or folders? Just run:


When you’re deleting a file, that would look like:


Or if you’re deleting a directory:


Plus, you can remove multiple files and folders simultaneously:


Special Characters

Occasionally, files and folders with special characters or spaces present a problem. In these instances, use quotes. For example:

cd /path/to/folder/"My Documents"

Running this without the quotes will fail to navigate into that directory.


linux command line master tricks

Using Linux requires the command line. Sometimes, you’ll need to know the history of commands run in the terminal. Viewing recently run commands is as easy as entering:


This yields a list that shows the command number and it corresponding bash command. Occasionally, this won’t be sufficient and you’ll need a timestamped history. In this case, run:


Then, you’ll see a list of the command history with dates and times. Sometimes you may wish to search for a command. That’s totally feasible with the command line. Just use CTRL + R at the bash prompt. Then, you’ll see a message which reads:


From here, you may begin to search for commands.

String Commands


While you can enter commands on separate lines, you can also run commands together. This is particularly useful when installing or updating software. That way, you can perform both actions simultaneously:

sudo apt-get update && sudo apt-get upgrade

Rather than the double ampersands, you can also string commands together in the Linux command line with a semicolon:

sudo apt-get update ; sudo apt-get upgrade

This performs the same action.



A PPA is a personal package archive Linux PPAs: Installation, Removal, and Security PPAs -- personal package archives -- are a way to install Linux software via the Terminal. But are they safe to use? How can you remove a PPA? And which are the safest PPAs to... Read More , or software repository not included in the default Linux OS system install. In order to load some software, you’ll first need to add a PPA. Like many Linux actions, this is usually performed with the command line.

sudo add-apt-repository [NAME OF REPOSITORY]

One of my favorite Linux software options is Open Broadcaster Software, used for game streaming Getting Started With Video Game Live Streaming on Linux Video game live streaming rose to prominence with the popularity of platforms like Twitch, but how can you stream your game play from a Linux computer? Read More . OBS requires a PPA addition before it’s fully installed:

sudo add-apt-repository ppa:obsproject/obs-studio

Re-Run Command

One of the most helpful commands to truly help you master the command line is the ability to repeat commands. A common method is by typing:


Moreover, you can use this and throw on a piece of the command you missed. For example, if you forget to run a command with super user permissions, entering


runs the command once more, this time adding super user permissions the second time. It saves you from having to type everything out again. But that’s not the only method to repeat commands. You can also use the up arrow to see previously entered commands, and hit enter to execute them again.

Similarly, you can enter:


Alternatively, pressing Ctrl + P shows the previously run command. Then, hit enter to execute it.


list command linux command line master tricks


A basic but incredibly useful command is the list function. This presents a list in the terminal which shows the major directories under a specific file system. For instance:

ls /apps

This yields a list of all the folders under the /apps directory.

How to Master the Linux Command Line: Final Thoughts

The Linux command line can seem daunting at first. But it’s not as complicated as it may appear. Managing files and folders, viewing the history of commands, and stringing commands together rank among the most common uses of the terminal.

There are loads of beginner tips for learning the Linux command line A Quick Guide To Get Started With The Linux Command Line You can do lots of amazing stuff with commands in Linux and it's really not difficult to learn. Read More . This multipurpose tool is even suitable for accessing Facebook Access Facebook From The Linux Command Line Virtually everyone, especially in first world countries, is on Facebook. Friends, events, pictures, and plenty more are all commonly found on Facebook unlike any other location. However, an ultimate geek may not want to use... Read More . Want to run the command line on Android? Try Termux for the full functionality of the Linux terminal How to Use the Linux Command Line on Android With Termux Termux lets you access a Linux command line on Android. Here's how to use Termux and some of its best offerings. Read More on Android operating systems.

What tips for mastering the command line do you suggest?

Related topics: Linux, Linux Bash Shell, Terminal.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. sukh
    October 19, 2019 at 8:59 pm

    Extreamly Helpful article in understanding the Linux basic commands as beginner

  2. Silverlokk
    November 24, 2017 at 3:48 am

    What, no file completion with the [Tab] key?


    cd /usr/home/user1/AndroidProjects

    While we're at it, the shortcut for the home directory is the tilde (~), so you can do

    cd ~/AndroidProjects

    And going back to file completion,

    cd ~/And[Tab]

    The Tab key will complete the filename for you so you get AndroidProjects.

    If you have more than one directory beginning with "And", the CLI will give you a list of those directories.

    IMHO, you need to know about shortcuts such as ~ and [Tab] file completion to "master" the command line

  3. Daniel
    November 17, 2017 at 3:53 pm

    If you run:
    it will give an error.
    If you do, for example:
    it will become: sudols
    for it to become sudo ls
    it mus be: sudo !!

  4. dragonmouth
    November 17, 2017 at 2:40 pm

    "A PPA is a personal package archive, or software repository not included in the default Linux OS system install"
    There is a very good reason for that. PPAs are repositories developed by third parties and are usable only by Ubuntu-based distros.. Ubuntu IS NOT the default Linux install and never will be. There are hundreds of other distros and most of them cannot use private repositories such as PPAs and AURs.

  5. Jim
    November 16, 2017 at 11:55 am

    I still prefer the GUI. I am a causal computer user and really don't want to learn and remember a bunch of commands if a GUI can do the same thing. No offense to those that do, I actually admire your commitment to the command line. Just not for me!

  6. mel
    November 15, 2017 at 3:36 pm

    sudo apt-get update && sudo apt-get upgrade


    sudo apt-get update ; sudo apt-get upgrade

    are not the same command.on the first one, `sudo apt-get upgrade` part of the command gets executed, if and only if, the the first part of the command `sudo apt-get update` gets executed and finishes successfully. Whereas on the second line, both commands will run sequentially, regardless of the success or failure of the first command.

    Please do not mislead people.

    • Gazoo
      November 16, 2017 at 2:21 am

      Thank you, Mel. Was going to post the same thing. Basically:

      A && B -- B will run only if A succeeds

      A ; B -- run A followed by B, regardless of whether A succeeds or not.

      A || B -- runs B only if A failed

  7. Colin
    November 15, 2017 at 2:35 pm

    Can someone explain/give example of what /path/to/folder/ means? Have tried google, but can only find PATH which I think is different to path. Not quite sure what to replace 'path' with. Thank you.

    • mel
      November 15, 2017 at 3:39 pm

      by `/path/to/folder/`, the author says, you will replace it with the full path to your file. For instance, if you want to see the system logs, provided you have root privileges on your linux machine, you type,

      cat /var/log/messages

      your /path/to/folder/ string becomes /var/log/messages in this example. It is a figure of speech for the lack of a better term.

  8. ??nn??
    November 15, 2017 at 1:43 pm

    "&&" and ";" arent performing the same action.

    "&&" executes the next command only if the command before exited with error-code 0.
    ";" executes the next command anyway

    like this:

    $ ls

    $ mkdir foo && touch bar
    mkdir: foo: File exists

    $ ls

    $ mkdir foo ; touch bar
    mkdir: foo: File exists

    $ ls
    foo bar

  9. dragonmouth
    November 15, 2017 at 1:36 pm

    "For Linux users, the command line is an essentially, and ultra-powerful tool. "
    Command line may be a ultra-powerful tool but it is no way "essential" to the use of Linux. By saying that it is, you are feeding into the FUD, spread by Window Fans, that one must be a CLI expert to use Linux. This is not the 1990's. Many distros can be used perfectly well without having to resort to the use of CLI.

    • B.Mkubwa
      November 15, 2017 at 6:21 pm

      Hail Hydra to that!