ORACLEOCP Certified Linux Foundation

Source: Internet
Author: User


Linux Foundation One, SHELL

In the system, the commands entered into the system are entered into the system in the form of a character type, but the system only recognizes 2 codes, as in the case of the previous Doc interface, the input is the English letter of the character class as the command code of the input, but obviously the binary code is different from the one we normally enter. Like two people who don't speak the language, they need to be translated.

Basically the shell is divided into two main classes: 1) graphical interface shell (graphical User Interface shell, GUI shell)

For example: The most widely used Windows Explorer (Microsoft's Windows Series production system) and also the well-known Linux shell, where the Linux shell includes X window Manger (BlackBox and Fl Uxbox), as well as more powerful CDE, GNOME, KDE, XFCE.

2) command line shell (Interface shell, CLI shell)

Example: BASH/SH/KSH/CSH (unix/linux system) cmd.exe/command prompt character (Windows NT System) Windows PowerShell (support for. NET Framework Technology for Windows N T system) The traditional shell refers to a command-line shell, which, if not specifically noted later, is a command-line shell.



Ii. Linux File and directory Management (i), directory tree

Under Linux, all files and directories start with the root directory. The root directory is the source of all directories and files, and then one branch down, a bit like a dendritic. Therefore, we also call this directory configuration as: "Directory Tree".

His main features are:

  • The starting point of the directory tree is the root directory (/, root);
  • Each directory can not only use the local-side partition file system, but also use the filesystem on the network. (NFS)

If we display the entire directory tree as an icon, and the more important file data is listed, then the directory tree schema is a bit like this:

(ii), absolute path and relative path

In addition to special attention to the FHS directory configuration, in the filename section we also have to pay special attention to Oh! The so-called path (path) can be defined as an absolute path (absolute) and a relative path (relative), depending on how the file name is written.

1. Absolute path

As we all know, in our usual use of the computer to find the required files must know the location of the file, and the way to represent the location of the file is the path. The absolute path is the real path to the file or directory on the hard disk. The absolute path name represents the unique name of the file within the file system.

For example, if you see this path: "D:\ORACLE\OCP.doc" We know that the "Ocp.doc" file is in the "ORACLE" directory on the D drive. The path that resembles such a complete description file location is the absolute path. As in Linux,/study/oracle/ocp/test.txt through this directory we can know test.txt under the root directory (/) under the study subdirectory of the Oracle directory. We can use CD/STUDY/ORACLE/OCP to view this file in the way of absolute path.

2. Relative path

The relative path is a relative to the absolute path. The absolute path can actually be understood, since we are in the directory, I want to go to the other subdirectories in this directory can direct the names of other subdirectories, and do not need to go through this directory and back to the directory you want. For example, I am now under the/opt. Then there is an Oracle directory under/OPT, which means that my current absolute directory is under/opt/oracle. However, there is also a OCP directory under/opt which means that the OCP absolute path is/OPT/OCP. Then I am now in/etc directory. However, we can go with the CD OCP to the OCP with the same in/etc without having to break into the/ETC/OCP absolute path of the common one.

(iii), LINUX directory structure
1. FHS

Because there are so many communities/companies and individuals that use Linux to develop products or distributions, if everyone uses their own ideas to configure a directory for file placement, it can be a lot of management trouble.

The Filesystem Hierarchy Standard (FHS) Document System hierarchy is therefore developed.

According to FHS's official paper, the main purpose of the http://www.pathname.com/fhs/is to let users know that the installed software is usually placed in that directory, so they want independent software developers, operating system creators, and users who want to maintain the system, are able to follow the FHS standard. In other words, the focus of FHS is to standardize what data should be placed in each particular directory. This is a lot of benefit because the Linux operating system is able to develop the unique style that developers want under the existing landscape (directory architecture unchanged).

In fact, FHS is based on the past experience has been continuously revised, FHS based on the use of the file system and whether or not to allow users to change randomly, and the directory is defined as four interactive forms, in the form of a bit like the bottom:

Shareable: can be shared with other systems to mount the use of the directory, so including the execution of files and users of the mail and other data, is able to share to other hosts on the network mounted directory;

Not to be shared: The device file or socket file related to the program is not suitable for sharing with other hosts because it is only related to its own machine.

Constant: Some of the data is not constantly changing, along with distribution without change. For example, a function library, file description file, the system administrator manages the host service configuration file and so on;

Variable: frequently changing data, such as log-in files, newsgroups that are normally accepted by users, and so on. In fact, FHS only defines what data should be placed under the three-tier directory for the directory tree schema.

Here are the definitions of the three directories below:

    • /(Root, root directory): related to boot system;
    • /usr (Unix software Resource): Related to Software installation/execution;
    • /var (variable): related to the system operation process.
2. Important directory for Linux


3. More specific directories in Linux

It is also a very important directory in Linux:

4. Two very important directories

1) The meaning and content of/usr:

Many readers will misunderstand/usr as user abbreviation, in fact, USR is the abbreviation of UNIX software Resource, that is, "Unix Operating system software resources" placed in the directory, rather than the user's data! Pay attention to this point. FHS recommends that all software developers should place their data reasonably in the sub-directory under this directory, rather than building the software's own separate directory.

Because all system default software (software provided by distribution Publishers) is placed under/usr, this directory is somewhat similar to the "C:\Windows\ + C:\Program files\" combination of Windows systems, When the system has just been installed, this directory will occupy the most hard disk capacity. In general, the sub-directory of/USR suggests the following:


2) The meaning and content of/var:

If/usr is a directory that occupies a larger hard disk capacity during installation,/var is the directory that will gradually take up the capacity of the hard disk after the system is operational.

Because the/var directory is primarily for files that are subject to normal changes, including cache, log file, and files generated by some software operations,

This includes program files (lock file, run file), or files such as MySQL databases, and so on. Common sub-directories are:


Three: Command 1 about the directory. View Help
  1 [[email protected] ~]# Man CD//view Help documentation for CD instructions


2. Display the current working directory
  1 [[email protected] ~]# pwd  2 /root
3. List the contents of the current directory: LS
1[[Email protected] ~]# ls [-aadffhilnrrst] Directory name2[[Email protected] ~]# ls [--color={never,auto,always}] Directory name3[[Email protected] ~]# ls [--full-time] Directory name4Options and Parameters:5-A: All files are listed together with the hidden file (files that begin with.) (common)6-A: All files, together with hidden documents, but not included. And.. These two directories7-D: Lists only the directory itself, not the file data in the directory (common)8-L: Long data string list, including file attributes and permissions and so on data; (common) (LL)9-N: Lists UID and GID instead of user and group name (UID and GID will be mentioned in account management!) )Ten-r: Reverse output of the sorting results, for example: the original file name from small to large, the reverse is from large to small; One-R: Listed along with the subdirectory contents, and all the files in that directory will be displayed; A-S: Sort by file size, not by filename; --T: Sort by time, not by file name. ---color=never: Do not give color display according to the file characteristics; the--color=always: Display Color ---color=auto: Allow the system to determine whether to give color according to its configuration ---full- Time: Output in full time mode (including year, month, day, hour, minute)
4. Switch directories

  1 [[email protected] ~]# CD///switch to root directory
5. Create a Directory
  1 [[email protected] ~]# mkdir Oracle//Create Oracle directory in current directory   2 options and Parameters:  3 - M: Set access permissions on the new directory or set the chmod command to   4 -P: Can be a path name. At this point, if some directories in the path do not already exist, plus this option, the system will be   5 automatically set up those that do not already exist, that is, multiple directories can be established at one time (cascade creation)  6 [email protected ] ~]# mkdir-p study/oracle/oc{a,p,m}  7 //Create study directory under current directory, create Oracle directory under study directory, Oracle Directory Built   8 OCA, OCP, OCM catalogue


6. Deleting a directory
  1 [[email protected] ~]# rmdir Oracle//Delete Oracle directory
7. Create a file
  1 [[email protected] ~]# Touch Oracle//Create a file named Oracle
8. Delete files/directories
  1 [[email protected] ~]# RM Oracle//Delete files named Oracle   2 options and Parameters:  3 -I: Before deleting A confirmation of the inquiry.   4 -F: Even if the original file attribute is set to read-only, it is deleted directly without confirmation.   5 -R: The directory and the following files are also deleted.   6 [[email protected] ~]# RM *.log//Delete all files ending with ". Log"   7 [[Email protected] ~ ]# RM-RF oracle///delete Oracle directory and cascade delete files in Oracle directory
9. Move Files/Directories
  1 [[email protected] ~]# MV Oracle/opt//Move archive Oracle to directory/opt
10. copy Files/directories
# CP [-adfilprsu] source file (source) target (destination)   2  [[email protected] ~]# CP [Options] Source1 source2 source3 .... di Rectory   3  options and Parameters:  4 -A: As-pdr means, please refer to the following instructions for PDR (common)  5 -D: If the source file is a property of the link file (link file), Copy the properties of the link file instead of the file itself;  6 -I: If the target file (destination) already exists, the action will be asked when it is overwritten (common) -R: Recursive continuous replication, used for the replication behavior of the directory; Commonly used)  9  finally note that if the source file has more than, then the last destination must be "directory"! 
11. Open File
  1 [[email protected] ~]# more Oracle.log  2 [[email protected] ~]# Less Oracle.log  3 [[email protected] ~]# tail-20f oracle.log//File tail output   4 [[Email Protected] ~]# cat Oracle.log
Iv. Users and Groups

(a), the user

1. UID and GID Linux are identified by UID (user ID) and GID (GROUP ID). The account is only for the convenience of user memory. The correspondence between ID and account is in/etc/passwd. What did Linux do when I signed in to Linux?

1) First find out if there is this account in/etc/passwd? If not then jump, if any, then the account corresponding UID (User ID) and GID (Group ID) read out, in addition, the account's home directory and shell settings are also read out;

2) Check the password list again! Then Linux will go into the/etc/shadow to find the corresponding account and UID, and then check the password you just entered and the password in the match?                     3) If everything is OK, go to the Shell control stage! 2./ETC/PASSWD/ETC/PASSWD/ETC/PASSWD/ETC/PASSWD and/etc/shadow/etc/shadow/etc/shadow/etc/shadow

1)/etc/passwd The structure of this file is this: Each line represents an account, a few lines will represent a few accounts in your system!

However, it is important to note that many of the accounts in the system must be required, we can simply call him a system account, such as bin, Daemon, ADM, nobody and so on, these accounts are required for the normal operation of the system.


  1 root:x:0:0:root:/root:/bin/bash  2 bin:x:1:1:bin:/bin:/sbin/nologin  3 Daemon:x:2:2:daemon:/sbin:/sbin/nologin  4 Adm:x:3:4:adm:/var/adm:/sbin/nologin

ORACLEOCP Certified Linux Foundation

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.