Linux Cloud Automation Basics 3 (basic commands for the system)

Source: Internet
Author: User
Tags file copy

1 Date

watch-n 1 Date # # #让date命令每秒执行一次, CTRL +C launch monitoring mode 650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/9C/5E/wKiom1lvXw7QMUIUAAAhCWlmSq8457.png "title=" Screenshot from 2017-07-17 23-41-47.png "alt=" Wkiom1lvxw7qmuiuaaahcwlmsq8457.png "/>


Date 11181115 # # #把系统时间设定为11月18日11:15 format: Every hour of the month


Date 111811152016.55 # #2016表示年 (can not be added). 55 = seconds (can not be added)

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/9C/5E/wKioL1lvX5Cho8CkAAAUjGuZDtE939.png-wh_500x0-wm_ 3-wmp_4-s_3559652075.png "title=" screenshot from 2017-07-17 23-46-53.png "alt=" Wkiol1lvx5cho8ckaaaujguzdte939.png-wh_50 "/>


-D +xday-xday # #查看x天前或者后的时间
+% .... # #设定date的输出格式

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/9C/5E/wKiom1lvX9rCk1PLAAA6uFOhvQM126.png-wh_500x0-wm_ 3-wmp_4-s_2337070203.png "title=" screenshot from 2017-07-17 23-47-54.png "alt=" Wkiom1lvx9rck1plaaa6ufohvqm126.png-wh_50 "/>



2.
passwd parameter User name
-S student # #用户密码信息
--status student ...
-L Student # #锁定帐号
-U student # #解锁
-N 1 Student # #设定密码最短有效期
-X Student # #设定密码最长有效期
-W 3 Student # #警告期
-I 2 student # #设定用户非活跃天数
-D Student # #清除用户密码
Note The user's permissions when using this command

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9C/5E/wKioL1lvYGLBUargAADXG2htMU8933.png "title=" Screenshot from 2017-07-18 22-29-07.png "alt=" Wkiol1lvyglbuargaadxg2htmu8933.png "/>


Monitoring passwd Password Information
Watch-n 1 passwd-s Student Ctrl +C Exit monitoring


650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9C/5E/wKiom1lvYKSz7LHWAAAlP68o2gY301.png "style=" float : none; "title=" screenshot from 2017-07-18 22-30-02.png "alt=" Wkiom1lvyksz7lhwaaalp68o2gy301.png "/>


650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/9C/5E/wKioL1lvYKSzClBUAAAlLOGCxFA871.png "style=" float : none; "title=" screenshot from 2017-07-18 22-29-19.png "alt=" Wkiol1lvykszclbuaaallogcxfa871.png "/>

10 indicates the minimum password validity period, 1000 is the maximum password period, 5 indicates the password warning period, and 3 indicates inactive days.

SHA512 is the encryption method of the password, the use of symmetric encryption here .


3.file
File name # #查看文件类型

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/9C/5E/wKioL1lvYPCjOROPAAAYU-6usjY225.png "title=" Screenshot from 2017-07-18 22-33-36.png "alt=" Wkiol1lvypcjoropaaayu-6usjy225.png "/>


4. Viewing of files
Cat filename # #显示文件的全部内容
Less file # #分页浏览, press "Q" to exit
Head FileName # #显示一个文件的前几行
Head-n 5 FileName # #前五行
Tail filename # #显示文件后几行
Tail-n 5 FileName # #显示一个文件的后5行
Tail-f File # #监控文件后 10 lines of content

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9C/5E/wKiom1lvYUqgb0gcAAAU2S-Gd5s767.png "title=" Screenshot from 2017-07-18 22-47-40.png "alt=" Wkiom1lvyuqgb0gcaaau2s-gd5s767.png "/>


Parameter-b outputs a standard line number, ignoring blank lines.

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/9C/5E/wKioL1lvYaTwcvXbAAAy97N8dAk195.png "title=" Screenshot from 2017-07-18 22-52-30.png "alt=" Wkiol1lvyatwcvxbaaay97n8dak195.png "/>

Parameter-n outputs the standard line number without ignoring empty lines.

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/9C/5E/wKiom1lvYcHAmhSFAAA26tkg8p0360.png "title=" Screenshot from 2017-07-18 22-52-45.png "alt=" Wkiom1lvychamhsfaaa26tkg8p0360.png "/>


5.WC Statistics File capacity information
Wc-l Number of rows
-W Words
-C byte number
-M character Count
6. Basic commands for document management
(1) Touch Create file or modify file timestamp

Touch File # #创建文件

(2) mkdir set up directory

mkdir Directory # #创建目录
Parameter-P # #上级目录不存在自动建立

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9C/5F/wKioL1lvZprQFNE5AAAqJJ1TgDY220.png "title=" Screenshot from 2017-07-19 22-02-21.png "alt=" Wkiol1lvzprqfne5aaaqjj1tgdy220.png "/>

Parameter-M # #指定文件权限

(3) RM Delete directory or File # # # # #

Rm-f # #强行删除不提示.
-R # #用于删除目录

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9C/5E/wKioL1lvYuTBtWF_AABydroL9aw320.png "title=" Screenshot from 2017-07-19 00-24-57.png "alt=" Wkiol1lvyutbtwf_aabydrol9aw320.png "/>



(4) Cat|head|tail view file Content # # # #

Cat|head|tail # #文件内容查看命令
Standard output common parameters for cat display files:-B output standard line numbers without ignoring blank lines
-N outputs standard line numbers, ignoring blank lines

(5) Vim text mode edit file

Vim filename enters the command mode
Command mode cannot edit the file if you want to edit the file to enter insert mode
Press "I" to enter insert mode
If you are finished editing, press "ESC" to eject the insert mode and enter ": Wq" to save the exit

Vim filename If the file name does not exist, it will be created automatically

Vim no Action object opened directly, after editing the file to: Wq filename # # # #记得加上创建文件的文件名 # # #

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9C/5F/wKioL1lvZcCRXHOUAAA5B70jl9Q853.png "title=" Screenshot from 2017-07-18 23-13-40.png "alt=" Wkiol1lvzccrxhouaaa5b70jl9q853.png "/>


7. CD Switch working directory

CD Directory # #切换工作目录到指定目录

CD-# #切换工作目录到之前所在目录

CD ~ # #切换到当前用户的家目录
CD ~usernmae # #切换到指定用户家目录

Cd.. # #进入到当前目录的上级目录. Note: ". "Represents the current directory

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9C/5E/wKioL1lvZZXw6NvMAAAwU7DGYmA130.png "title=" Screenshot from 2017-07-18 23-17-26.png "alt=" Wkiol1lvzzxw6nvmaaawu7dgyma130.png "/>



8. LS lists directory or file information

LS # #如果后面没有目标那么默认目标为当前目录
LS Directory|filename # #列出文件或目录内容
ls-d Direcotry # #列出目录本身
Ls-l Filename|dorectory # #列出文件或目录里面内容的属性
Ls-ld Directory # #列出目录本身属性
Ls-a # #显示目录中的所有内容, including with "." Hidden files at the beginning
Ls-r # #递归显示目录中的内容



650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/9C/5E/wKioL1lvY5vTOm6UAABPCvgOaFQ890.png "style=" float : none; "title=" screenshot from 2017-07-18 23-33-46.png "alt=" Wkiol1lvy5vtom6uaabpcvgoafq890.png "/>

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9C/5E/wKiom1lvY5uR721wAAAhhnjExGA049.png "style=" float : none; "title=" screenshot from 2017-07-18 23-21-16.png "alt=" Wkiom1lvy5ur721waaahhnjexga049.png "/>

Note: The meaning of the second line of letters. The first d is the directory for the property of the file, and the following rwx indicates that the file owner has read, write, execute power, and then r-x that the group members have read and execute power, and the latter r-x indicates that the other person has the right to read and execute.

9. cp File Copy

CP is the process of creating a new file

CP file File1 file2. Directory # # #把file file1 file2 copied to directory
CP File Test # # # #建立test文件模板为file
Cp-r Directory Direcotry1 # # #复制目录 parameter-R
-P # # #复制权限
-V # # #显示复制过程中的详细信息

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9C/5E/wKioL1lvYzHwZpGDAACQ_Dpl8io535.png "title=" Screenshot from 2017-07-18 23-55-52.png "alt=" Wkiol1lvyzhwzpgdaacq_dpl8io535.png "/>



9.MV Move or rename

The MV of the same disk is renamed, and the MV of different disks is the copy-delete process

MV file file1 direcotry # #移动file file1 to Directory
MV exists file does not exist file # #重命名文件
MV Westos/linux. # #把westos中的linux移动到当前目录. Represents the current directory

PWD Print Working direcotry
>> PWD Displays the current working directory
>> pwd-p Show real directories for soft links only

One. Stat command to view the timestamp of a file
The time that access was accessed
Modify when the content was modified
The change file was modified at the time

650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/9C/5F/wKioL1lvZk3xqVWqAABY63oIjP4168.png "title=" Screenshot from 2017-07-19 00-14-27.png "alt=" Wkiol1lvzk3xqvwqaaby63oijp4168.png "/>



12.less
Paging through files, using when files are too long
/keyword search keywords

Q exit
V gedit = GNOME EDIT

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9C/5F/wKiom1lvaH6zMvzzAAFa6kKXAFo535.png "title=" Screenshot from 2017-07-19 22-10-03.png "alt=" Wkiom1lvah6zmvzzaafa6kkxafo535.png "/>



13.gedit = text editor for GNOME edit       graphics   &NBSP
       gedit file     Open File and edit
        ctrl+s             Save
       ctrl+n         Open a new editing interface
        ctrl+o           Opening a new file
14.rm = remove                Delete file or directory
   Common parameters
    >>-f       forcibly delete without prompting
     >>-r       Delete directory
    >>-d        Delete empty directory



Man->>manual # # #man是手册缩写
Man Man # # # # #查看man命令的帮助
Man passwd # # #查看passwd命令的帮助



man level
1     system commands
2     System Interface
3      Libraries
4     Special files, such as device files
5     files
6     Games
7      System Packages
8     System administration commands
9     kernel

Man 5 passwd    # help #查看/etc/passwd file
Man 1 passwd    # #查看passwd命令的帮助, 1 can omit

man page shortcut
down arrow              # #向上或向下一行
pageup|pagedown        # #向下一个屏幕或者向上一个屏幕
d|u            # #向下或者向上半个屏幕
g|gg             # #跳转页面到man最下面或最上面
/keywords              # #搜索关键字, keywords are highlighted, n is matched, n up
q            ## Exit the help page


This article is from the "13122425" blog, please be sure to keep this source http://13132425.blog.51cto.com/13122425/1949111

Linux Cloud Automation Basics 3 (basic commands for the system)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.