Functions and Applications of commands cd, ls, and cp in linux

Source: Internet
Author: User

 

Today, the teacher told us to write commands in the linux environment, mainly about cd, ls and cp

Common commands

1. Understand the directory information after linux Installation

All lowercase letters (case sensitive)

Ls --- list (Display)

[Root @ localhost root] #

Root directory of the root user-Home Directory

[Zhy @ localhost ~] $

[Current login username @ machine Name Current Directory] Administrator

/Boot/swap

2. Change the path cd (chang directory)

Path name changed by cd

Cd/

/--- Top-level directory, root directory

Bin-binary executable program (green) for normal users

Sbin ---

Man ls

Root -----

Su command for changing user identity

1) changed from common user to root

$ Su

Password: Not Displayed

2) changed from root to normal user

# Su zhangsan

No Password required

First Command: ls

# Man ls

Function: displays contents in a directory.

Syntax: ls [parameter] [file]

Parameters:

-A, -- all: displays all files (including hidden files starting );

-L: displayed in long format

10-rwx rw-r --

File Type author permission group permission others permission

111 110 100

4 + 2 + 1 = 7 4 + 2 = 6 4

764

 

R: read 4

W: write 2

X: executable 1

V587

Number of links

File author

File author group

File size (B)

Modify the month, date, and time

File Name

-S: displays the file size.

-S: sort by file size)

 

Files displayed in long format are sorted by file size at the same time.

Ls-l-S

Ls-lS (recommended)

 

File color:

Blue: indicates the directory file.

Green: indicates the executable file.

RED: indicates the compressed file.

Gray: other files

 

The second command: cp

Function: Copies one or more files to the target directory.

Syntax: cp [parameter] source file or directory target file or directory

Parameter:-f: if the target file or directory already exists, you will not be asked whether to delete it or not. Delete it and copy it again.

-I: If the target file or directory already exists, ask the user if they want to delete it and copy it again.

-R: recursively copy the directory, that is, copy the directory together with the subdirectories and files under the directory.

-P: Maintain the source file owner, permission, and time mark during replication.

For example, copy a to the user directory [root @ localhost root] # cp a user

 

From zl943588435

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.