15 Best Terminal Commands That You Should Know
Tags: php, programming, webdev, beginners
Published: 2022-07-26 04:32:00

As a developer, they are working with SSSL(Server Site Scripting Language), Programming languages, and other languages and software too. So, they work with a terminal which is a tool, that gives information about your pc, allowing unknown sources, etc. Terminal wants a particular command to run and there are lots of commands are available to use. Here, you can see the one of best commands for a terminal. So, let's see the commands for the terminal.

### 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. ls
ls gives you a content list of current directory.
```
Syntax of ls:
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.

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
```