loading...

All you need to start with Command Line

developer_anand profile image Anand Jha ใƒป4 min read

Command line is an essential tool for software development.

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.

โœจ Let's start to learn (can use it as a reference guide)๐Ÿƒโ€โ™‚๏ธ๐Ÿƒโ€โ™‚๏ธ๐Ÿƒโ€โ™‚๏ธ...

  • To create a new file = touch file_name

You can create an empty file by typing touch file_name and executing it.

To create a new file!

  • To display the content of a file = cat file_name

You can also display the content of a file with the cat command.

To display the content of a file!

  • To create a directory = mkdir directory_name

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.

To create a directory!

  • To move to other directories = cd directory_name

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

To move betweeen directories!

  • To check the current directory = pwd

    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.

To check the curretn directory!

  • To display the content of the directory = ls

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.

To display content of directory!

  • To move to the parent directory = cd..

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

  • To move to the home directory = cd

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

  • The home directory is represented by ~

    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.

  • To moving a file = mv file_to_move destination_name

    By typing mv file_to_move destination_directory, you can move a file to the specified directory.

  • To moving a directory = mv directory_to_move destination_directory

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.

To move directory!!

  • To Renaming a file = mv old_file_name new_file_name

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.

To rename a file!

  • To copying a file = cp file_to_copy new_file_name

The cp command is used to copy a file content.

To Copy file!

  • To copy a directory = cp -r directory_to_copy new_directory_name

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.

To copy a directory!

  • To Remove a file = rm file_to_remove

The rm command is used to remove a file.

To remove a file!

  • To remove a directory = rm -r directory_to_remove

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

To remove a directory!

  • To clear the screen = clear

    We use clear command to clear the screen

Posted on by:

developer_anand profile

Anand Jha

@developer_anand

Hey, I am a software developer and here to share my experience and views.

Discussion

markdown guide
 

Keep moving ahead like this ๐Ÿ‘
And I like the way that how you explained it easily