Simple use of Linux, linux

Source: Internet
Author: User
Tags create directory

Simple use of Linux, linux

1. Basic commands

Create directory pathA: mkdir pathA

Go to the directory pathA: cd pathA

View directory content: ls

View the file details in the directory: ls-l, Or ll (l is lower case L, don't look at the error)

Copy the file fileA to the directory pathA (same-layer directory premise): cp fileA pathB

Copy the directory pathA (including all in the directory) to the directory pathB (same-layer directory premise): cp-r pathA pathB

Delete file fileA: rm fileA

Delete the directory pathA (including all in the directory): rm-r pathA

Move all files in the/usr/test directory to the current directory: mv/usr/test /*.

Compress pathA with gzip: tar zcvf pathA.tar.gz pathA

Decompress pathA.tar.gz: tar zxvf pathA.tar.gz

Create a soft connection for fileA slFileA: ln-s fileA slFileA (l is lower case L, don't look wrong)

Create a hard connection for fileA hlFileA: ln fileA hlFileA

View all processes: ps-aux

Kill a process (process ID is used to specify the process): kill-9 process ID

Refresh the End Content of fileA (used to dynamically view logs in actual work): tail-f fileA

Clear fileA (such as clearing the log file): truncate-s 0 fileA

2. File Permission

View the permission information in the current directory: ls-l

The first output field is the encoding of the description file and directory permissions.

The type of the first character gem file for this field:

-Represents a file

D indicates the Directory

L represents the link

C stands for generic devices.

B Indicates the block device.

N indicates a network device.

The next three characters define three access permissions:

R indicates that the file is readable.

W indicates that the file is writable.

X indicates that the file is executable.

Access Permissions are divided into three groups, one group of three characters (rwx). If you do not have any permissions, use. The first group specifies the owner of the object, the second group specifies the group of the object, and the third group specifies other users of the system.

Example: Give the owner of the readme.txt file readable and writable, and grant the read-only permission to others: chmod 644 readme

3. simple use of Vim

View the fileA file: vim fileA

Edit the fileA file: vim fileA ---> Insert key ---> move the cursor to the desired location for editing ---> edit ends Press Esc to end editing

Save and exit the edit fileA: shift Key +; ---> wq ---> Enter key

Discard the previous modification and exit: shift Key +; --->! Q ---> Enter key

Free copy: v ---> move the mouse to select the content to be copied (starting point is the starting position of the cursor) ---> y

Copy a row: yy

Copy all: gg ---> v ---> shift Key + g ---> y

Free cut: v ---> move the mouse to select the content to be copied (starting point is the starting position of the cursor) ---> d

Paste: p

Search for test: Enter the command in vim:/test (then press n to find the next one, and press N to search up)

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.