Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Collation of basic commands commonly used in Linux

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the basic commands commonly used in Linux". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the basic commands commonly used in Linux".

1. Cp (copy files and directories) copy a file or directory

Cp source file target file

Cp source file destination directory

It is found that the copied file is different from the source file at the same time.

The cp command is generally used to back up files

2. Mv (move (rename) files) move, cut or rename the file name

Mv [options] Source file or directory destination file or directory

It is often used to change the file name or move the file to a certain directory in the actual production process.

-t move the directory and all the following contents to the target directory

Mv-t destination directory source file or source directory (special format)

Mv-b file 1 file 2 directly overwrite the previous backup of file 2

Overwrite the file 234.txt directly, and back up the original 234.txt file

3. Ifconfig view or configure network device parameters

Ifconfig network device parameters

Ifconfig eth0 up/down starts / shuts down the eth0 network card

At this time, SecureCRT can no longer connect to the system.

Use ifconfig eth0 up to open the network card

4. Ln creates a link file

Ln parameter source file or directory destination file or directory

I mentioned this command earlier when I introduced the linked file.

Ln source file target file create hard link file

Ln-s source file target file create soft link file

5. Tar compressed files or directories

Tar parameter package name source file or directory

Z is packaged into .gz package format

V displays the packaging process

C set up compressed files

F use the file name, and you can only receive the file name after this parameter

X decompression

J is packaged into .bz format

T shows that the contents of the compressed package are not compressed

6. Date (print or set the system date and time)

Display or modify date and time (system)

Date parameter format [time or date]

% y year (14 simplified format display)

% Y year (2014 format)

% m month

% d day

% H hours (expressed as 00-23)

% M minutes (expressed as 00-59)

% F all day (display date in full format)

-d displays the date and time indicated by the string. Strings must be enclosed in double quotation marks

-s sets the date and time according to the string. Strings must be enclosed in double quotation marks

Date +% Y%m%d-- date= "+ 1 day" displays the date of the previous day

Date +% Y%m%d-- date= "- 1 day" shows the date of the following day

Date +% Y%m%d-- date= "- 1 month" shows the date of the previous month

Date +% Y%m%d-- date= "+ 1 month" shows the date of the next month

Date +% Y%m%d-- date= "- 1 year" shows the date of the previous year

Date +% Y%m%d-- date= "+ 1 year" shows the date of the next year

Actual combat case

The / etc/hosts file is required to be backed up with time as the file name

Cp / etc/hosts / etc/hosts.root.$ (date +% F)

Ls-lrt / etc to display the recently created file

Look for files in the / etc directory to include the current time

7. Cat display file

Cat option file name

Often used in conjunction with redirection >

-n number all lines of the file output

-b numbering non-empty input

Write the contents of a file directly to another file (which may not exist) this function is similar to echo

File merge function

8. Which users find all paths of the command

Which command

9. File users get file attributes

File file name or directory name

In fact, there are many basic commands, we only need to be familiar with the commands and related parameters that can be used in the actual production environment.

Thank you for your reading, the above is the content of "the basic commands commonly used in Linux". After the study of this article, I believe you have a deeper understanding of the basic commands commonly used in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report