# Linux Commands:~ First step towards DevOps Engineering Part:- 1

`ls`: List the contents of a directory

```plaintext
ls
```

`pwd`: Print the current working directory.

```plaintext
pwd
```

`touch`: Create New file.

```plaintext
touch hello.txt
```

`vim`: Text editor with normal, insert, and command modes.

```plaintext
vim hello.txt
```

**Insert Mode:** To start inserting text into the file, you need to switch to Insert mode. There are a few ways to enter Insert mode:

* **i**: Press `i` to enter Insert mode before the cursor position. You can start typing text at the cursor.
    
* **I**: Press `Shift` + `i` to enter Insert mode at the beginning of the current line.
    
* **a**: Press `a` to enter Insert mode after the cursor position. You can start typing text immediately after the cursor.
    
* **A**: Press `Shift` + `a` to enter Insert mode at the end of the current line.
    
* **o**: Press `o` to open a new line below the current line and enter Insert mode.
    
* **O**: Press `Shift` + `o` to open a new line above the current line and enter Insert mode.
    

After Inserting inside the Vim editor Just write "Hello everyone, i am currently Devops"

To save changes and exit, you can use: use Esc and

```plaintext
:wq
```

`cat`: Concatenate and display files.

```plaintext
cat hello.txt
```

`grep`: Search for a string/word in a text file.

```plaintext
grep "hello" hello.txt
```

now Again use Vim editor, open hello.txt and write list of fruits inside editor

"

Apple, Banana, Orange, Strawberry, Blueberry, Grape, Pineapple, Mango, Watermelon, Kiwi, Peach, Pear, Cherry, Raspberry, Lemon, Lime, Avocado, Papaya, Cranberry, Blackberry.

"

`sort`: Sort results alphabetically or numerically.

```plaintext
sort hello.txt
```

`tail`: Display the last N lines of a file.

```plaintext
tail -n 10 hello.txt
```

`ping`: Check if a host is responding.

```plaintext
ping google.com
```

`mkdir`: For Creating a new folder.

```plaintext
mkdir helloworld
```

`cd`: For changing directory

```plaintext
cd helloworld 
```

Now you can again create file and folder inside helloworld directory.

`history`: to check how many commands you use in your machine

```plaintext
history
```

for checking last 5 commands , you can use:-

```plaintext
history 5
```
