# Handy Linux terminal commands for beginners

**1. Accessing the help pages**

Here are two ways to view the help or manual page of any Linux command.

**a.	man** command – Manual. 

This command is used to view the user manual page for any Linux command.

Syntax:  man [command]

To run it simply type **man** followed by the command you want to view the manual page for.

eg.  ``` man man```
 – This will display the manual page for the **man** command
 
 
![man page.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650805884379/6GtoXYfJW.png)

 
-	Press h in the man page to view the help section of the manual

-	To exit the man page, press q on the keyboard


**b. --help** command - This provides information on a particular command.

Syntax: [command] --help

Eg. ```man --help```

![help.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650805897198/WtMbUBsAX.png)
 
**2. Working with files and directories (folders)**

One of the most common tasks we perform on our computers is navigating directories or folders using a GUI application like **Windows Explorer** in Microsoft Windows or **Finder** in Apple MacOS. 
Below are some commands for performing common tasks when working with files and folders:

**a.	pwd** command – Print working directory.

This command shows you the folder you are currently working in.

Command: ```pwd```


![pwd.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806052563/EOpnVJFNJ.png)

From the image above, the **pwd** command shows that I am working in the /home/josh directory.

**b.	ls** command – List

This command is used to display the contents of a folder

Command: ```ls```
 
This will display the contents of the current folder.


![ls.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806061057/DAvjhKeQB.png)

**c.	mkdir** command – Make directory

This command is used to create a folder or directory

Syntax: mkdir [foldername]
 
Eg. ```mkdir tutorials```


![mkdir.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806095241/da1eaqUyz.png)

In this example, I created a folder called **tutorials**, then I used the ```ls``` command to confirm that it was created.

**d.	cd** command – change directory

This is used to navigate to a different directory or folder.

Syntax: cd [foldername]

![cd.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806269365/F986hHqAG.png)

Eg. ```cd tutorials```

This will change my working directory to the **tutorials** directory.
This means that my current working directory will change from **/home/josh** to **/home/josh/tutorials**

![cd 2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806299317/_W163mICZ.png)
 
**e.	cp** command – Copy 

This command is used to create a copy of a file

Syntax – cp [source] [destination]

![cp.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806360403/hlE_YXR6z.png)
 
Eg. 1. ```cp file1.txt notes.txt```

This will create a copy of **file1.txt** and name the copy **notes.txt**

![cp 2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806373563/Fo0eEYWQv.png)

Eg. 2. ```cp file1.txt tutorials/```

This will create a copy of **file1.txt** in the **tutorials** folder.

![cp 3.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806459973/YkJSiHp1u.png)
 
**f.	mv** command – Move

This command has two uses – 
It can be used to **move** files from one location to another.
It can also used to **rename** files or directories.

Eg. 1. Moving **file1.txt** to the **tutorials** directory

Command: ```mv file1.txt tutorials```
 

![mv.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806479984/RsEGA0RD2.png)
 
**File1.txt** is now in the **tutorials** directory

Eg. 2. Renaming a file with mv

Command: ```mv file1.txt renamed.txt```
 
![mv 2.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806487585/tdJrN4QA9.png)

This changes the name of **file1.txt** to **renamed.txt**

**g.	rm** command – Remove

This is used to delete files.

Syntax: rm [filename]

Eg. Deleting **renamed.txt**

Command: ```rm renamed.txt```

![rm.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1650806529003/dBicLAWTs.png)

You can view more information about all the commands used by accessing their respective **help** and **manual** pages.

 

