# Getting Started with Linux Terminal

Hello there, In this article, we'll take a look at some of the basic commands used in Linux-based systems.

# Anatomy of a basic Linux prompt

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688728815/HSb8u-_i8.png)

- In lines 1 and 2, we see `hardik@nitro5-fedora`. Here `hardik` is the username of the logged-in user and `nitro5-fedora` is the name of the pc.
- In line 1, `~` indicates that we are in the **home** directory.
- In line 2, `/` indicates that we are at the **root** of the filesystem.
- The `$` symbol indicates that you are interacting with the system as a regular user. If you have **sudo** privileges, the `$` turns into a `#`.

> NOTE: From here on now, I’ll be using *zsh* instead of *bash*. But don't go away just yet. The commands discussed here work just the same on *bash* as well. :P

# Some basic Linux commands

## date

`date` command is used to show the current system date and time.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688744164/8vc1vmgML.png)

## ls

`ls` command lists the files present in the current directory.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688766537/tEz6S5r2m.png)

Let’s take a look at some important flags for `ls` command

- `-R`
    
    This flag lists the files recursively i.e. it will also list the file present in subdirectories and their subdirectories and so on
    
    Here’s a sample
    
    ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688784750/zxuUoFZA-.png)
    
- `-l`
    
    This flag shows some additional information about the files like *permission string*, *owner*, *group* of the *owner*, file size in bytes
    
    ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688803346/Ka5fdo5Xr.png)
    
- `-a`
    
    This flag lists *hidden* files as well
    
    ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688834968/5bw_J_ixd.png)
    

## cat

`cat` command is used to display, copy, combine and create new files.

- Creating new files
    
    ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688848461/fZ7Sc64fA.png)
    
- Viewing a file
    
    ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688868555/aWf73l4xu.png)
    
- Combining two files
    
    ![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688889067/lS54TJySR.png)
    

## pwd

`pwd` stands for *print working directory* and does the same.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688902550/1UwVAbEv3.png)

## rm

`rm` is used to delete files. `rmdir` can be used to delete directories.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688916196/1z3USb-Ap.png)

You can use `-rf` flag to delete a directory recursively.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688929279/1LJ69HEtB.png)

## cd

`cd` stands for *change directory* and is used to do the same.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688941707/IXXiU9R2C.png)

> Please ignore the *warnings.* They are related to my prompt configuration.


**Some important `cd` commands**

- `cd ..` is used to navigate to one level up in file system.
- `cd ~` navigates you to your **home** folder.

## mkdir

`mkdir` is used to create a new directory.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688977752/6M_RIGbIB.png)

## mv

`mv` stands for *move*. It is used to move files around the file system. It can also be used to rename files

**SYNTAX**

`mv [OPTIONS] source destination`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640688988564/dsz--aZh_.png)

## cp

`cp` stands for *copy* and is used to copy files and folders

**SYNTAX**

`cp [OPTIONS] source destination`

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640689000187/lZpZL625V.png)

## man

`man` command is used to access documentation of the commands that are available in the os. Here is a sample

```bash
man curl
```

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640689012710/M08OuSvsP.png)

To exit this page, press `q`

## history

`history` command shows the commands used in this terminal session.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1640689032629/HA2BBAuem.png)

## clear

`clear` command clears the terminal. In modern *terminal emulators*, you can press `Ctrl + L` to do the same.

---

Hope you liked this short article. See you next time. :D
