15 Best Terminal Commands That You Should Know
Tags: github, opensource, developer, javascript
Published: 2022-10-11 17:40:03

**List of Best Commands For Terminal**

1. PWD(present working directory)
2. cd(change directory)
3. ls
4. mkdir(make directory)
5. echo
6. touch
7. cat
8. diff
9. head
10. tail
11. rm(remove directory)
12. clear
13. Redirection operators (> & >>)
14. cp
15. mv



## **1. PWD - best command for terminal**
PWD command stands for present working directories from your computer device. It reflects your prevailing location to the file.

```
Syntax of PWD:
pwd -L: Prints the symbolic path.
pwd -P: Prints the actual path.
```

## **2. CD - best command for windows**
CD command stands for changing your directory from your current location.

It is used to change your current location on the computer by selecting a different part in your pc. But you want to define the particular part below to change your location. It's one of the best commands for terminal.

And there are some tricks to go back and ahead. If you want to go back simply type the .. for it and you want back multiple times you add in it / sign.
Syntax of CD:

```
cd /
cd
../cd 
```

## **3. 1s**
1s gives you a content listof current directory. Similar to this command already exists, its used to get the more longer list of your current directory's content by using -1.
Syntax of 1s:

```
ls
ls -l
ls -a

```

## **4. MkDir - Best Command For Windows**
MkDir command is used to make directories in the computers. It is also known as make directory in terminal. You can also create multiple directories using this command, it takes permission accepted by you.
Syntax of MKDIR:

```
mkdir [options...] [directories ...]
```

## **5. echo - Best Command in PHP**
By using echo you can print anything as you want. It prints strings/parameter also for best outputs. To print a string you need to assign $ sign before the variable to print.
Synyax of echo:

```
echo [option] [string]
```

## **6. touch - Most used command in terminal**
Mostly touch command is used to create a file in pc. It also used for change file access and modification time of particular file. If the file is not available in directory then it create new file.
Syntax of touch:

```
touch file_name
```

## **7. cat - best shortest command in terminal**
cat command is used to concatenate the strings and variable to get the best outputs. It is generally used for combine code in single line.
Syntax of cat:

```
$cat filename
```

## **8. diff - Best command to compare strings**
diff command is used to compare lines or strings and get the difference between each file. Let's see the syntax of diff command. It's one of the best commands in terminal.
Syntax of diff:

```
diff [OPTION]... FILES
```

## **9. head - Best command to print content in terminal**
head command is used to print the content of file from beginning. It is used to print headings in a file. Its one of the best commands in terminal.
Syntax of head:

```
head [OPTION]... [FILE]...
```

## **10. tail - Best commands for terminal**
tail command is used to print content of file from the end. It is generally used to print the conclusions or massages. It's one of the most used commands in terminal.
Syntax of tail:

```
tail [OPTION]... [FILE]...
```

## **11. RM - Best commands for windows**
rm command is used to delete directory from file in pc. You need to just define part of directory and then it removed by the using command. Let's see the syntax of the command.
Syntax of rm:

```
rm -i mydir
rm -i mydir/*
```

## **12. clear - Most used commands for terminal**
This command is used to clear the screen of pc. It is used to clear out the current terminal window and takes back the prompt to the top position of the terminal window.
Syntax of clear:

```
Ctrl+L
```

## **13. Redirection Operators**
is used to redirect the output from command to pass the another file. It will overwrite the content of file. Its one of the best commands for terminal.

is used to redirect the output from a command to be passed to another file. This will append to the content of the file.
Syntax of operator:

```
ls -al > listings

```

## **14. cp - Best command for terminal & windows users**
cp command is used to copy file from one directory to another one.
Syntax of cp:

```
cp [OPTION] Source Destination
cp [OPTION] Source Directory
cp [OPTION] Source-1 Source-2 Source-3 Source-n Directory
```

## **15. mv - Most used commands for terminal**
mv command is used to move file in one directory to another directory. Its one of the most used commands in terminal.
Syntax of mv:

`$ mv [options] source dest`