Linux basic Commands (3)

Source: Internet
Author: User

1. Use commands with absolute paths, such as

$/bin/ls

2. View the user's preset path

$ echo $PATH

$/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Multiple paths separated by colons, if a command has two versions of the path exist, such as/usr/local/bin and/usr/bin, then the former is selected for execution;

3. Add a command path

If the system cannot find a command, the path to the command must be added to the search path

$ export path= $PATH:/usr/bin;

The above command indicates that the path of/usr/bin is added after the original search command.

4. Put the command in the background and back from the background

$ gcc hello.cc &

[1] 21475

After the command & will put the command in the background, return [1] is assigned to the command of the work sequence number, 21475 is the process identification code

$ FG%1

$ FG 21475

These two commands can bring the previous command back to the foreground from the background

$ kill%1

Terminate the command

5. Reference manual, manual pages

$ man ls; View ls command

$ man 1 ls; 1 indicates command code

$ apropos Edit: Query the command related to edit, the system according to the name in the manual find

$ info Find

6. File Ownership and Permissions

Read, readable, write, writable (add or delete files), execute, executable (listing the relevant information in the directory)

UNIX File permissions: Owner (owner), Group of file owner (group), other user (others)

The results of the LS-L command are as follows

7. Change permission Commands

First, you must be a root

$ chown bin sample; Change the owner of the sample program to Bin

$ chgrp bin sample; Change the group of sample programs to Bin

$ chmod +x header; Add executable permission to header file

$ chmod-x Header;

$ chmod u+x header; Set executable permissions only to yourself

$ chmod ug+rwx header; Assign multiple permissions at once

$ chmod Absolute mode header;

$ umask Absolute mode header;

Such as:

$ chmod 777 header; Open all permissions for all users, 7=4+2+1;

$ chmod 741 Header:user All permissions, group Read and execute, other execute permissions

$ umask The absolute mode is reversed, take the complement

such as: $ umask 027 Headr; With the same effect as the chmod


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.