Linux entry command (1)

Source: Internet
Author: User

Before starting, define the meaning of the symbol:
# Represents the root shell. $ represents the shell of a general user.
First, we will introduce some basic commands in Linux:
(1) man
English description: man is used to provide detailed help for familiar or unfamiliar commands.
The installation path of the default document is under the/usr/man directory.
Example:
[Bkbll @ market man] $ man ls
LS (1) fsf ls (1)
NAME
Ls-list directory contents
SYNOPSIS
Ls [OPTION]... [FILE]...
DESCRIPTION
List information about the FILEs (the current directory
Default). Sort entries alphabetically if none of-cftuSUX
Nor -- sort.
...............................................................................
Press the Space key to flip the page and enter/followed by the query content to query.
Press q or ctrl + c to exit. in linux, you can use ctrl + c to terminate the current program.
Of course, your English is better.
(2) ls
Description: view the directory or file attributes and list the files under a directory.
Example:
[Bkbll @ market man] $ ls/usr/man
Man1 man2 man3 man4 man5 man6 man7 man8 man9 manl mann share whatis
You can also do this:
[Bkbll @ market bkbll] $ ls-l
Total 704
Drwxr-xr-x 5 bkbll 4096 Feb 21 11: 24 Desktop
-Rw-r -- 1 bkbll 34545 Jul 18 Filter-1.23.tar.gz
-Rw-r -- 1 bkbll 3805 Mar 20 1996 Makefile
Drwxrwxr-x 2 bkbll 4096 Mar 8 Net
-Rw-r -- 1 bkbll 60834 Mar 21 1996 README
-Rwxrwxr-x 1 bkbll 18239 Jul 27 a. out
-Rwxr-xr-x 1 bkbll 2463 Jul 16 apache3.pl
-Rw-r -- 1 bkbll 10320 Jul 16 bind. c
-Rw-r -- 1 bkbll 25 Jul 9 11: 56 cool. t
-Rwxrwxr-x 1 bkbll 12052 Mar 1 crypt
-Rw-r -- 1 bkbll 174 Mar 1 12:02 crypt. c
Drwxrwxr-x 2 bkbll 4096 Jul 16 data
The following is a detailed description of the above meaning.
Drwxrwxr-x 2 bkbll 4096 Jul 16 data
| --------- | -----------------------------
1 2 3 4 5 6 7 8
1 indicates the file structure. For example, d indicates the directory. If it is a "-", it indicates a file. If it is l, it indicates a connection file (link ).
2. file or directory permission. Read (r), write (w), and run (x ).
Rwx r-x
----------
U g o
The u table shows the file owner, which is represented by 4th items in the list above. The file owner is bkbll,
G indicates the group where the file is located. The above 5th items indicate that the file group is bkbll.
O indicates others.
The above indicates that the file owner bkbll is allowed to have readable, writable, and executable permissions.
Allow members in the bkbll file group to have readable, writable, and executable permissions.
Allow others to have the read and executable permissions.
It can be represented by an octal number.
0000 the first digit from the right indicates x, the second digit indicates w, and the third digit indicates r.
For example, rwx can use 7 to represent. bin (111) = oct (7 ).
The above attributes can be represented by 775.
If you want other files to have data-like permissions, you can use chmod 775 to convert the file names.
3. indicates the directory hierarchy. For example, 2 indicates that there is a subdirectory under the data Directory. Therefore, all files are 1.
4. indicates the file (or directory) Owner.
5. indicates the group to which the file (or directory) belongs.
6. file or directory size, in bytes.
7. file or directory creation date.
8. file or directory name
(3). cp
Description: copy an object.
Usage: cp filename1 filename2
Copy filename1 to filename2
Example:
[Bkbll @ market bkbll] $ cp fing. c lpd/fing2.c
[Bkbll @ market bkbll] $ ls lpd/
Fing2.c qib. tgz
[Bkbll @ market bkbll] $
Copy fing. c under the current directory to the fing2.c file under the lpd directory.
Tip: Add a-r parameter to the copy directory.
(4). rm
Description: delete files and directories.
Usage: rm file name or directory name.
Example:
[Bkbll @ market bkbll] $ ls lpd/
Fing2.c qib. tgz
[Bkbll @ market bkbll] $ cd lpd
[Bkbll @ market lpd] $ ls
Fing2.c qib. tgz
[Bkbll @ market lpd] $ rm fing2.c/*** Delete the fing2.c File
[Bkbll @ market lpd] $ ls
Qib. tgz
[Bkbll @ market lpd] $ rm qib-r/** Delete directory qib
[Bkbll @ market lpd] $ ls
Qib. tgz
[Bkbll @ market lpd] $
Note: deletion is not as easy to restore as windows does.
(5). mv
Chinese description: remove the directory or change the file name.
Usage: mv filename1 filename2
Example:
[Bkbll @ market lpd] $ mv qib. tgz qi. tgz/** Renamed
[Bkbll @ market lpd] $ ls/** list
Qi. tgz/** is renamed
[Bkbll @ market lpd] $ mv qib. tgz ../qib. tgz/** move to the upper-level directory
Mv: qib. tgz: No such file or directory/** qib. tgz file does not exist. Hold the error
[Bkbll @ market lpd] $ mv qi. tgz ../qib. tgz/** re-submit
[Bkbll @ market lpd] $ ls-l ../qib. tgz/** list, successfully moved.
-Rw-r -- 1 bkbll 13321 Feb 28 ../qib. tgz
[Bkbll @ market lpd] $
(6). cd, pwd
English description: cd changes the current directory pwd to view the complete path of the current directory
Usage: cd path name; pwd
Example:
[Bkbll @ market bkbll] $ pwd/** view the current directory path
/Home/bkbll
[Bkbll @ market bkbll] $ cd ftp/** switch to the ftp directory
[Bkbll @ market ftp] $ pwd/** switch. Check the current path.
/Home/bkbll/ftp/** is different from the above pwd?
[Bkbll @ market ftp] $
Cd, pwd usage. Now let's continue. Note: The html format used last time, the red format represents the command we entered, for example:
[Bkbll @ market lpd] $ mv qi. tgz ../qib. tgz/** re-submit.
Because of my mistakes, the whole line was converted to red, which made reading difficult and misunderstood by comrades. In fact, the correct format should be:
[Bkbll @ market lpd] $ mv qi. tgz .. /qib. tgz/** the blue color indicates the user's shell environment. bkbll indicates the current user name. If you use xieshou, then it is [xieshou @ ********] $. the "@" after it indicates the meaning of "in. next is the name of the current machine. For example, the name of this machine is market, which is defined in the/etc/hosts file. you can view the file through cat/etc/hosts. for example:
[Bkbll @ market bkbll] $ cat/etc/hosts
127.0.0.1 localhost
202.202.50.40 market.eschool.edu market
[Bkbll @ market bkbll] $
Note that this "market" refers to the machine name. The lpd behind it represents the name of the current directory. As mentioned in the previous section "$", it is the shell of a common user,
If it is root (super administrator.
7. cat, more command Description: display the content of a file. The two commands are different: cat prints the file content all the time, and more is displayed on a split screen.
Usage: cat filename; more filename example:
[Bkbll @ market bkbll] $ cd own/** switch to the own directory
[Bkbll @ market own] $ ls/** list directory content
1. c 1.h 2.c
[Bkbll @ market own] $ cat 1.c/** displays the content of the 1.c file.
Main (){
Int I;
I = 6;
Printf ("% d", I );
}
[Bkbll @ market own] $/** wait for USER command input.


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.