Linux Basic command, archive, compress, view file content __linux

Source: Internet
Author: User
Tags mkdir save file file permissions

Linux

/--root directory (top-level directory)

ls---Display the contents of the file

Man ls--Help manual, function, syntax, parameter exit Q

bin--(green) Normal user's command

root--Root User's host directory

Medi--、 mnt--mount point

cp--Replication directory: cp–r/etc dir_1

*.tar.gz--Archive Compression Red

cd--Open File

TAR–ZXVF file name--Extract Files

ls--help--help manual is about the same as man LS

su--Change User example: An administrator changed to John Su Zhangsan

boot--linux kernel files, you can view the best not to edit

dev--External Equipment

etc--configuration file

home--Default host directory for all normal users

usr--Command (green)

sbin--system the command used by the binary system administrator

CP--HELP--CP Help manual

tab--the function on the keyboard: The command is padded, the filename is filled

touch--file name already exists update time

no create empty file exists

mkdir--Create an empty directory mkdir directory name

mv--transfer file or rename

 

location in file permissions representing file types

d--Directory Blue

---Files green, red, black

l--Connection files (shortcuts are similar to Windows shortcuts) light blue

r--Read Only w--write only

 

 

Archive

-c--create Create an archive file

-t--list Display archive content

-X---Recovery (release) archive

-c--Specify external media when saving archive files

-f--Specify the name of the archive file

-v--shows the details during execution

 

1) Create archive (backup) is not compressed

TAR–CVF User.tar passwd Shadow

2 View archive content (multiple archive coexistence)

TAR-TVF User.tar

3 Release the archive (need to restore the system)

TAR-XTF User.tar

 

 

Compress

Zip bulk compression. zip

Create Compressed Package zip *

Extract Unzip * (or specify extract file name)

 

gzip single compression. GZ

Create compressed file gzip file name

extract Gzip–d Compressed file name

extract Gunzip Compressed file name

 

tar-z Common Files

Example: TAR-CZVF user1.tar.gz passwd Shadow decompression

TAR-ZXVF user1.tar.gz Release

 

 

View File Contents

ls--Display file (folder) attribute aspect information

cat--Browse file contents cat file name > orientation >> redirect

more--Paging display more file name

carriage return indicates the next line

a space indicates the next page is displayed

disadvantage: Can only move down, can not be rolled back

less--with more similar, can move up less file_1

> Directional à save file name to file

ls/sbin > File_1

ls/sbin > File_1

Cat File_1

How many times to redirect only the last time, not append, overwrite

For example: File_1 has 20 words WC file_1 Display 20

 

>> redirect--ls/sbin >> file_2 ls/sbin >> file_2

Append, double, do not overwrite

For example: File_2 has 20 words WC file_2 Display 40

 

wc--Statistics

-w-c-L

For example: WC file_1 WC file_2

 

head--Display the first few lines

head-2 passwd display passwd first two lines

tailà display after a few lines

tail-3 passwd display passwd after 3 lines

 

Example: Show line Tenth

head-10 passwd | TAIL-1 passwd

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.