> For the complete documentation index, see [llms.txt](https://devops-3.gitbook.io/devops/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://devops-3.gitbook.io/devops/docs/module-1-linux-introduction/basic-commands.md).

# Basic Commands

While performing a task, we all need shortcuts. Shortcuts help us to complete a task quickly. Linux comes with such commands which are one to two words, using that commands, you can perform several operations in no time.&#x20;

As a beginner, you must be aware of those **basic Linux commands** to complete an operation in a short time in the **Linux-based operating system**.

<figure><img src="/files/BSVXSTnAUbjUgcC4Il2N" alt=""><figcaption><p>Basic Commands</p></figcaption></figure>

### Use of Linux Commands

**Linux commands** are a type of Unix command or **shell** procedure. They are the basic tools used to interact with Linux on an individual level.&#x20;

Linux commands are used to perform a variety of tasks, including displaying information about files and directories.

### Basic Commands

1. ls command

```bash
ls   // Displays information about files in the current directory.
```

The ls command is commonly used to identify the files and directories in the working directory.

There is a lot of flexibility offered by this command in terms of displaying data in the output.

2. pwd command

```bash
pwd   // Displays the current working directory.
Ex: pwd >> o/p = home/ubuntu
```

The **pwd command** is mostly used to print the current working directory on your terminal.

Now, your terminal prompt should usually include the entire directory. If it doesn’t, this is a quick command to see which directory you’re in.

3. cd command

```bash
cd   // To navigate between different folders.
Ex: cd file
```

The **cd command** is used to navigate between directories.&#x20;

It requires either the full path or the directory name, depending on your current working directory.&#x20;

4. mkdir command

<pre class="language-bash"><code class="lang-bash"><strong>mkdir // Creates a directory.
</strong><strong>Ex: mkdir file
</strong></code></pre>

This mkdir command allows you to create fresh directories in the terminal itself. The default syntax is **mkdir \<directory name>** and the new directory will be created.

5. rmdir command

```bash
rmdir // Removes empty directories from the directory lists.
Ex: rmdir file
```

The **rmdir command** is used to delete permanently an empty directory. To perform this command the user running this command must be having **sudo** privileges in the parent directory.&#x20;

6. touch command

```bash
touch   // Create empty files.
Ex: touch file.txt
```

The **touch command** creates an empty file when put in the terminal in this format as touch **\<file name> .**

7. **rm command**

<pre class="language-bash"><code class="lang-bash"><strong>rm   // Delete files.
</strong><strong>Ex: rm file.txt
</strong></code></pre>

**rm command** in Linux is generally used to delete the files created in the directory.&#x20;

You can see as we wrote the **ls** command to view the files in the terminal and then **rm \<file name>** to delete the files and again we had the **ls** command to check the update.

8. echo command

```bash
echo // Print on the terminal.
Ex: echo "Hello DevOps Engineer"
```

**echo command** in Linux is specially used to print something in the terminal

9. man command

```bash
man // Access manual for all Linux commands
Ex: man ls
```

The **man command** displays a user manual for any commands or utilities available in the Terminal, including their name, description, and options.

10. &#x20;cat command

```bash
cat // Display file contents on terminal.
Ex: cat file.txt
```

The **cat command** is the simplest command to use when you want to see the contents of a particular file.&#x20;

The only issue is that it simply unloads the entire file to your terminal. If you want to navigate around a huge file, should use **less** command alternatively.
