Simple shell commands

Source: Internet
Author: User
Tags temporary file storage
Part 1 simple common commands

1. Date command

 

2. Display calendar Cal

 

3. display the current directory pwd

 

4. Switch the current working directory

By default, the main directory of a Super User is/root, while that of a common user is the same subdirectory as that of the user in/home.

Super User, that is, the root user's display symbol is :#

The common user's display symbol is: $

 

5. View File Information ls

-A shows all files and subdirectories, including hidden files and hidden subdirectories. in Linux, hidden folders and hidden subdirectories start.

-R not only displays the files and sub-information directories under the specified directory, but also recursively displays the files and sub-directory information in each sub-directory.

 

6. display the content of the file cat

Cat-N ddView ddThe content of the text file, and the row number is displayed in front of it.

7. Split the screen to display the content of the text file more

MoreFile Name

 

8. display the end content of a text file. Tail

Tail [Option]File

 

9. Clear the screen clear

 

10. display the number of lines, characters, and characters of a text file WC

-C only displays the number of bytes.

-L only display the number of objects

-W: only display the number of words in the file

 

11. MPS queue |

Pipeline is another major feature of shell. It links multiple commands to form a pipeline stream. Every command in the pipeline flow is run as a separate process, the output result of the previous command is used as the input of the next command and executed from left to right.

 

12. History

Each user has a directory named. bash_history under his/her home directory.To save the shellCommand. A maximum of 1000 characters can be saved by default.Record

 

Part 2 common file operation commands

 

1. Move or rename a file or directory mv

 

2. copy the file or directory CP

 

3. delete a file or directory RM

 

4. Find command

 

5. Create the directory mkdir

Part 3 manage permissions

1. Basic concepts of users and groups

Linux is a real multi-user operating system. Multiple users logging on from the local machine or remotely can simultaneously use the same computer and access the same external device, different users have different user permissions for the same resource.

2. Users

Linux users are divided into three types: Super Users, system users, and common users.

Super User: Also known as root user, has the highest permissions on the computer. Only Super Users can set and modify all systems.

System users: system users are users related to system services. They are usually automatically created when software is installed and do not need to change their default settings.

After installation, a common user is created by a Super User. the permissions of a common user are limited. Only files and directories with permissions can be operated, and only processes started by the user can be managed.

3. Group

Linux users divide users with the same features into a group, which greatly simplifies user management and facilitates file sharing among users. Any user belongs to at least one group. It is further divided into system group and private group.

4. Basic shell commands of the Management Group

4.1 create a new user

Useradd [Option]User Name

-C full name

-D main directory

-E Validity Period

-G group ID

-U user ID

......

 

4.2 Delete a user

Userdel [-R]User Name

-R means not only deleting this user account, but also deleting the user's home directory. If the-r option is not used, only the user's account will be deleted.

 

4.3 display information about the File System

DF [Option]

-A: displays the usage of all file systems.

-T file system type

4.4 Linux File System

/----- LinuxSystem directory tree

------ BinStore executable files

------ BootFiles at system startup

------ EtcFor examplePasswd

------ HomeHome Directory of a common user

------ LibShared libraries of binary files

------ RootMain directory of the Super User

------ TMPTemporary File storage directory

------ USRApplication directory

------ VaRFiles frequently changed in the system, such as log files

------ Dev

------ Media

------ Mnt

------ Sbin

 

To facilitate the management and identification of different files, Linux divides the system into four categories: common files, directory files, link files, and device files.

 

4.5 File Permissions

4.5.1 access permission

Read Permission, write permission, and execution permission

4.5.2 permission-related user categories

Owner): User who creates a file or directory

Same group owner (Group): All users in the group to which the file belongs

Other users (others): Neither the file owner nor ,,

Super Users have all permissions for files

4.5.3 representation of Access Permissions


4.6 modify File Permissions

Chmod digital mode file

Chmod function mode file

U g o stands for users, user groups, and other users respectively

Chmod U + R File

 

Chgrp changes the group to which the file belongs

Chown changes the file owner

 

Related Article

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.