linux learning 13 Linux operation and maintenance of common file management commands and system variables foundation

First, the file management commands

  1, cp command, copy

    a, single source replication, cp [OPTION] ... [-T] SOURCE DEST

      If DEST does not exist: the pre-create this file, and copy the data flow to the source file in the DEST.

      If there is DEST:

        If the DEST non-directory file overwrite the destination file, if the file is a directory DEST create a file with the same name as the source file in the DEST directory, and copy its data stream to the target file.

    b, multi-source copy

      cp [OPTION]... SOURCE... DIRECTORY
      cp [OPTION]... -t DIRECTORY SOURCE...

      If there is no DEST: Error

      If there is DEST:

        If a non-directory file DEST: Error

        If the file is a directory DEST: each copy each file to the target directory, and keep the original name

    c, cp -i: interactive copy, that is to remind the user for confirmation before coverage

    d, cp -f: mandatory coverage target file

    e, cp -r: recursive copy directories

[root@localhost /]# cp -r /var/log/ /tmp/
[root@localhost /]# ls /tmp/
a_c  a_d  b_c  b_d  functions  hi.txt  log  vmware-root  x

    f, cp -d: If you copy a symbolic link soft link like this shortcut, the default will he source data file will be copied, if we do not want to copy the data source file only symbolic links you will need to copy plus -d option.

    g, cp -a: not only copy the source file data source file also retains all metadata attributes. By default, this parameter is added cp -dr --preserv = all parameter. --preserv options are as follows

      --preserv=

        mode: Permissions

        ownership: the owner and group

        timestamps: timestamps

        context: security label

        xattr: Extended Attributes

        links: symbolic link

        all: All of the above properties

  2, mv command: move  

    mv [OPTION]... [-T] SOURCE DEST
    mv [OPTION]... SOURCE... DIRECTORY
    mv [OPTION]... -t DIRECTORY SOURCE...

    a, mv -i: Interactive Copy

    b、mv -f :force

  3, rm command: remove

    a、rm -i :interactive

    b、rm -f:force

    c、rm -r:recursive

    d, Delete directories: rm -rf / PATH / TO / DIR

    e, note: all the different files is not recommended deleted, but moved to a special directory :( simulation Recycle Bin)

Second, variable

  1, named memory space

    Variable types: integer, floating point, character, Boolean, date and time type

      Character:

      Numeric:

        Exact numeric:

        Approximate values:

      Variable type determines the storage format, the range of data involved in computing

Guess you like

Origin www.cnblogs.com/Presley-lpc/p/12043933.html