Some basic commands in linux tar, cp, rm, touch, mkdir, etc.

tar extract command:

tar -c build archive   tar -x-extracting archive   tar -t view the content

The following is a way to extract the file attributes

   extracting attributes -z gzip    -j decompression bz2 properties    -v display process

-F which is required, is the last parameter -f decompression, followed by the file name;

E.g:

Decompressing: tar -xvf file.tar --- extract the tar file

    tar -xzvf file.tar.gz --- extract the tar.gz file

    tar -xjvf file.tar.bz2 --- decompression bz2 file

Compression: tar -cvf file.tar * .ext - all documents suffix called ext compressed into file.tar

    tar -czf file.tar.gz * .ext --- suffix all the documents called ext compressed into tar.gz

cp Copy command

-i: Interactive -r, -R recursively copy the directory and all internal content. -v display detailed information of the copy, -f force

-r / R recursive
 
 -n does not cover (so that the foregoing -i failure)
-i, - interactive interactive mode (so that the -n failure)
-a, - archive copied, retain all (including mtime, atime, the file's owner, permissions, etc.)
-L, - dereference follow symbolic links (default)
-P, - no-dereference do not follow symbolic links, which is the only copy a symbolic link, do not copy the actual file the symbolic link points
-v Show Details
-u, - copy-update when the source file is relatively new
-b backup file of the same name ending with ~
--remove-destination copy previously deleted
-f If the target file can not be opened, then delete and then copy (-n -f parameter will fail)
For example: cp -R dir1 dir2 copied into the Contents directory dir1 dir2
   CP -f file1 file2 to the file file1 file2 force replication
 
 rm command to delete
rm -rf file file delete file or folder, forced to delete
 
touch create documents
touch file to create a file file
 
 
mkdir create folders
 
mkdir [-p] dirName
  -p sure that the directory name exists, that does not exist on a build.

 Multiplex folder

mkdir -p test1 / test2 / test3 ... create a folder test1, test2.test3

If the current directory has test1, then create a folder represents test2 / test3

 

Guess you like

Origin www.cnblogs.com/ybyu-python/p/11088220.html