Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use the shell command in linux

Shulou Source: shulou.com Published: 2022-06-03 06:26:28 10月17日 Update

Today, what the editor shares with you is a detailed introduction of the shell command in linux. I believe most people don't know much about it. In order to make you understand better, the editor summed up the following content for you. Without saying much, let's move on.

In this article, we will introduce some of the basic commands used in Linux shell.

View and jump command

(1) pwd

When opening the terminal, if you need to know which directory you are currently in, you can use the pwd command, which returns an absolute path (the path starting from the root "/").

(2) ls

Use the "ls" command to know what files and folders are in your directory. You can use the command "ls-a" to view all hidden files.

(3) cd

Use the "cd" command to jump to the appropriate directory. When using it, make sure that the following target directory exists.

Free video tutorial recommended: Linux video tutorial

File and folder command

(1) mkdir and rmdir

Mkdir is used to create directories and rmdir is used to delete directories. Note that rmdir can only be used to delete an empty directory. To delete the directory that contains files, use rm.

(2) rm

Use the RM command to delete files and directories. But RM cannot simply delete directories. Use "rm-r" to delete the directory (with a parameter r), and at this point, the folder and the files in the folder are deleted.

(3) touch

The touch command is used to create files. It can produce any file, either an empty txt file or an empty zip file.

For example:

Copy and move files

(1) cp

Use the cp command copy file. It requires two parameters: the first is: where does the copy file come from, and the second parameter is where to copy the file?

(2) mv

Use the mv command move file. We can also rename the file using the mv command, which is similar to cp.

For example:

The above is the knowledge summary of the shell command in linux, the content is more comprehensive, the editor believes that there may be some knowledge points that we may see or use in our daily work. I hope you can learn more from this article.

Tags: Files commands directories folders parameters knowledge content tutorials videos paths parts two most locations daily work more goals look knowledge points Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Shulou Technology Redmi Shulou Tech Info