What is Command Prompt in Linux? [Commands & Navigation]

There are many ways to execute commands in Linux or any operating system. The oldest and the most flexible method of performing commands is through the command line interface. To do that, we use a program called terminal or command prompt in Linux. Command prompt is the go-to method for developers as it provides the best functionality of the operating system.

What is Command Prompt?

Command prompt is a program with a text-based interface that takes input as text and sends it to the operating system to perform operations. In Linux, it’s just a window with a blinking cursor where we can write our command.

Command Prompt window

The command line interface is the interconnect between the application and the kernel. Any command needs to go through the command line. So, the command prompt lets us interact with the operating system’s kernel. Extensive knowledge of command prompts in Linux will help you apply complex commands that are otherwise impossible through the GUI.Command Prompt structure

How to Open a Command Prompt?

There are many ways to open the command prompt in Linux. Here are 3 methods to open the command prompt in Linux.

1. Opening a Command Prompt Using GUI

This is the easiest method and is suitable for beginners. This method relies on the GUI (Graphical User Interface). Here are the steps to open Command Prompt using GUI:

  1. Press the Bottom Left icon to Show Application. All the applications installed in the machine will appear.Command Prompt opening using Desktop Open Applications
  2.  In the search box, type Terminal. An application named Terminal will appear.Command Prompt search for terminal
  3. Click on Terminal. Then a window will appear. This window is the command prompt where you can type your command and see it run in the window.Command Prompt

2. Opening Command Prompt Inside a Directory

You can open the command prompt inside a directory without typing commands to go inside.

To open the command prompt inside a directory, follow the steps described below:

  1. From the Desktop, click on the Files icon from the left sidebar. The left sidebar is also called the Vertical Task Management Panel.Command Prompt pressing on Files
  2. A new window will appear. This is the Home directory inside Linux. Let’s say you want to go inside the Documents folder. Use Left Double Click to go inside the Documents folder.Command Prompt double clicking Documents
  3. Now you’re inside the Documents folder. Let’s say you want to open the command prompt inside the Document folder. Right Click anywhere inside the folder except on a file. Then Click on Open in Terminal.

    Command Prompt clicking on Open in Terminal

  4.  Command prompt or Terminal will open. If you look at the prompt, it will show that it is in the Documents folder.Command Prompt opened in Document Folder

3. Opening Command Prompt Using Shortcut

This is the easiest method of opening the command prompt. On the keyboard, type CTRL + ALT + T and the command prompt will appear. If you look at the prompt, you’ll see a ~ symbol and a $ symbol. The ~ symbol means the Home directory and $ indicates the end of the path. That means you’re currently inside the Home directory.

Command Prompt Using Shortcuts

Commands for Navigation Inside the Command Prompt

Generally, we use the GUI to navigate through the command prompt. But in this section, you’ll learn to navigate using the command prompt. You can use this method for more professional use, like automation.

The cd command

The cd (change directory) command will let you change the current directory. Using this command, we can navigate inside or outside a directory.

The ls command

The ls (list) command is generally used to list the available files inside a directory. This command helps us understand what files or folders are inside a directory.

The pwd command

You can use pwd (print working directory) command to print the Absolute path of the current directory. This way, you can also keep track of your current directory without losing your way, even if the directory structure is quite complex.

Navigation Using the Command Prompt

Suppose you have a directory folder structure like the following image.

Command Prompt folder structure

You want to navigate in this folder structure using the command prompt. First of all, you need to remember that when you open the command prompt, the current directory is set as the Home directory by default. We have a folder named LinuxSimply on the Desktop.

Command Prompt opened in Home directory

Now to navigate the directories using the command prompt, you can follow the following two methods:

1. Change the Directories Using Relative Path

Relative path means file path relative to the current directory. Using the following steps, you can use the Relative path in the cd command.

To move to a specific directory with the relative path, follow the process given below:

  1. Open the command prompt. By default, it is opened in the Home directory. On the Desktop, you can see the LinuxSimply folder.
  2. To get inside that LinuxSimply, at first, we need to go inside the Desktop. Type the following command
    cd Desktop/

    Then press ENTER. You can also type TAB for auto-completion. Just type cd Des and type TAB. The prompt will autocomplete the rest of the command.

  3. You can type ls command to see the files or folders inside.

    Then press ENTER. You’ll see the files inside your Desktop. In this case, only the LinuxSimply folder is shown because that’s the only folder in the Desktop directory.

    Command Prompt inside desktop folder

  4. If you want to go inside LinuxSimply, just type
    cd LinuxSimply

    Then press ENTER. Again. Using ls command, you can view that Folder_1 and Folder_2 are inside LinuxSimply folder.

    Command Prompt path navigation using Relative path

2. Change the Directories Using Absolute Path

Using this method, you can access any path using the cd command. But you have to write the whole path or the Absolute Path after the cd command. The Absolute path is the path that starts from the Home Directory and ends in the current directory. Let’s say you want to get inside the LinuxSimply folder, then Folder_2, and then FF3. You also want to view the file name inside the directory.

To move to a specific directory with the absolute path, follow the process given below:

cd Desktop/LinuxSimply/Folder_2/FF3


As we can see, there’s a file name Moby Dick.txt

You can use pwd command to see the actual absolute path of the current directory.


Command prompt path navigation using Absolute path


In this article, you learned about the command prompt in Linux, its use, and how we can use it to navigate inside folders. You learned about the cd, ls, and pwd commands. You also learned about the Relative path and absolute path and how to use them in the cd command. These are some of the most essential commands that you’ll probably use. So, I recommend you memorize them or bookmark this page if you need to review them.

People Also Ask

What is command-line in Linux operating system?

The command-line in a Linux operating system provides a text-based interface for users to interact with the system by entering commands. It is often referred to as the shell. The command-line interface (CLI) allows users to execute various commands to perform tasks, manage files, configure settings, and run programs. Users type commands into the terminal, and the system responds with text output.

For example, the ls command is used to list files in a directory, cd is used to change the current directory, and mkdir is used to create a new directory. The command-line is powerful and efficient, offering users fine-grained control over the system

What is the syntax of Linux commands?

The syntax of Linux commands follows a general pattern:

command [options] [arguments]

The command represents the specific action or operation you want to perform, such as listing files or copying directories. Options, often indicated by a hyphen or double hyphen, modify the behavior of the command, allowing you to customize its execution. These options are optional and may influence the output format or specify particular settings. Arguments are the inputs or targets for the command, such as file names, directory paths, or other parameters required for the command to act upon.

How to check all Linux commands?

To check all available commands in Linux, you can explore the system’s directories where executable files are stored. The typical locations for these files are specified in the system’s PATH variable. You can list these directories using the following command:

echo $PATH

This will display a colon-separated list of directories where executable files are located.

Similar Readings

Rate this post
A Complete Guide for Beginners Enroll Course Now
icon linux
Md. Rafsan Zani

Hello, I’m Md. Rafsan Zani. I have recently completed my Undergraduate from the Bangladesh University of Engineering and Technology (BUET). Currently, I’m pursuing higher studies abroad. I’m really interested in computer science and would like to learn a lot about the wonderful world of computers. Currently, I’m working as a Linux Content Developer Executive and find Linux really interesting. I certainly would like to learn more about Linux and implement them in my future studies. Read Full Bio

Leave a Comment