Lesson2 Linux directory operations pwd, cd, cp, mv, rm, mkdir, rmdir

 A, Linux Contents Introduction:

Table of Contents 1. There are two default files. And .., created and deleted by the system.

2. The user home directory denoted by ~.

3. pwd Print the current working directory print working directory.

4. cd change the current working directory.

Two, cp copy files:

 1. Command Format: cp [options] source file destination

 2. Command options:

      -f overwrite the source file

      -i prompted to overwrite

      -p The modification time and access permissions are also copied together

  Example:

cp *.c /home/ziair

Three, mv move files:

 1. Command Format: mv file target multiple source files

 2. Command Usage: mv dir1 dir2 dir1 and dir2 dir will move to the next folder dir

                        mv old.txt new.txt the same name for file name 

Four, rm to delete the file:

 1. Command Format: rm [options] multiple source files target files

 2. Command options:

      -r recursively remove a directory tree

      -f Forces deletion

      -i delete a file every need confirmation

3. explicit distinction between command options and handling objects: Many unix commands - the end of an explicit sign of commands and options.

     Example: Delete the file named -1, rm -rf -1 error, should be replaced by rm -rf - -1

五、 mkdir、rmdir:

1. mkdir: create directory.

2. rmdir: delete a directory, it asked to be deleted directory other than the .. and no other files and directories.

 

Published 45 original articles · won praise 30 · views 10000 +

Guess you like

Origin blog.csdn.net/sinat_40471574/article/details/104950426