All you need to start with Command Line
Tags: commandline, unix, basicsofcommandline
Published: 2020-05-05 08:59:49

><h1>Command line is an essential tool for software development.</h1>

The **command line** is a tool for interacting with a computer using only text (also known as a text interface) rather than other methods like clicking and scrolling. 

<p>✨ Let's start to learn (can use it as a reference guide)🏃‍♂️🏃‍♂️🏃‍♂️...</p>

>- To create a new file = **touch file_name**
 
<p>You can create an empty file by typing touch file_name and executing it.</p>

![To create a new file!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--RKNdKmgD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qnlntplxwyiotd4ouxks.gif)

>- To display the content of a file = **cat file_name**

<p>You can also display the content of a file with the cat command.</p>

![To display the content of a file!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--Uv8wzNJr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8k5jyuh8fzr8lltoz2eq.gif)

>- To create a directory = **mkdir directory_name**

<p>You can create a new directory using a command as well.   A directory is commonly used interchangeably with the term folder.   To create a directory, use the mkdir command.</p>

![To create a directory!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--_QzSFoc---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/axpfdcqa2xx2vf270w6l.gif)


>- To move to other directories = **cd directory_name**

<p>You can use the cd command to move to other directories.   By entering cd directory_name, you can move to the specified directory.</p>

![To move betweeen directories!](https://res.cloudinary.com/practicaldev/image/fetch/s--7ZVh7_AX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hqqz7mdl0z2wyr7axiak.gif)


>- To check the current directory = **pwd**
<p>
On the command line, it is important to know the directory you   are currently working in. There is a command called pwd to check that.
</p>

![To check the curretn directory!](https://res.cloudinary.com/practicaldev/image/fetch/s--3V8hBXfy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/zc8x64v83cupsyn77bw5.gif)

>- To display the content of the directory = **ls**

<p>When moving between directories, it would be convenient if we could see    the list of files and directories in the current directory. To do this, you    can use the ls command.</p>

![To display content of directory!](https://res.cloudinary.com/practicaldev/image/fetch/s--OAZ_CRV2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mb3bqmhd0wblcskhito4.gif)


- To move to the parent directory = **cd..**

<p>If you want to move to the parent directory, you can use a special   symbol .., like cd ...</p>

- To move to the home directory = **cd**

<p>
If you execute cd without specifying a directory, you can move to what is called a home directory.
</p>


- The home directory is represented by **~**
<p>
The Home directory refers to the base directory for the user.Since it is important, moving to the home directory is made to be easy.</p>

- To moving a file = **mv file_to_move destination_name**
<p>
By typing mv file_to_move destination_directory, you can move a file to the specified directory.</p>

>- To moving a directory = **mv directory_to_move destination_directory**

<p>
With the mv command, you can also move directories, not just files.
By entering mv directory_to_move destination_directory, you can move all the files and directories under that directory.</p>

![To move directory!!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--e7cquU4H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/t31sfyg3gisqq1m7yamn.gif)

>- To Renaming a file = **mv old_file_name new_file_name**

<p>The mv command, which we used to move files and directories earlier, can also be used to rename a file.
You can rename a file by typing mv old_file_name new_file_name.</p>

![To rename a file!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--Upb-kSSD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/e87msrwtaquirwr9uj7k.gif)

>- To copying a file = **cp file_to_copy new_file_name**

<p>The cp command is used to copy a file content.</p>

![To Copy file!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--meyC7YKQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/krufbxwa4aqr3h2woh9s.gif)

>- To copy a directory = **cp -r directory_to_copy new_directory_name**

<p>With the cp command, you can also copy a directory by adding the -r (Recursive copy) option, like cp -r directory_to_copy new_directory_name.</p>

![To copy a directory!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--hWDI_vs7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ti0mg364x7bzenxg9ngk.gif)


>- To Remove a file = **rm file_to_remove**

<p>The rm command is used to remove a file.</p>

![To remove a file!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--gEt5Yg2U--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v80xozyz0gqorwf6t1ww.gif)

>- To remove a directory = **rm -r directory_to_remove**

<p>You can also remove a directory by adding the -r option to the rm command, like rm -r directory_to_remove.</p>

![To remove a directory!]
(https://res.cloudinary.com/practicaldev/image/fetch/s--vigTBBVJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/79v6p4j0c74a11w24ugp.gif)

>- To clear the screen = clear
<p>We use clear command to clear the screen</p>