Linux Learning Introductory Standard Tutorial (2)

Source: Internet
Author: User

Linux System Chapter 2.1 Linux System Management

After the first two chapters of the study, we can now independently installed Linux system, now has mastered the Linux learning tips, then, we will be the system to understand the Linux system directory, permissions and the use of common commands.

2.1.1 Linux Directory initial knowledge

Through the previous study, we have been able to install a Linux system independently, then we will be familiar with the Linux system in the various directory folders of the approximate function:
The main directory tree has/,/root,/home,/usr,/bin and other directories. Here is a typical Linux directory structure as follows: (with chart)

650) this.width=650; "src=" http://www.centoscn.com/uploads/allimg/150528/1-15052Q64QSA.png?_=5557262 "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto; "alt=" 1-15052q64qsa.png?_=5557262 "/>


/root directory
/bin storing the necessary commands
/boot Store the kernel and the files needed to boot
/dev Store device files
/etc Store System configuration file
Home directory for normal user, user data is stored in its main directory
/lib storing the necessary runtime libraries
/MNT stores temporary mapping file systems, which are typically used for mounting.
/proc storing stored process and system Information
/root home directory for super users
/sbin Storage System Management Program
/tmp Storing temporary files
/USR stores applications, commands program files, libraries, manuals, and other documents.
/var system default log storage directory


2.1.2 Linux Essentials commands

By default Enter the system, we will see such characters: [[email protected] ~]#, where # represents the current root user login, if the $ represents the current user as normal.
We understand that Linux is made up of many directory files, so let's learn the first Linux command:
cd command, Cd/home; parse: Enter/home directory
Cd/root into the/root directory; CD. /return to the previous level directory; CD./current directory; (. and.. Can be understood as relative path, e.g. Cd/hom/test, CD plus complete path, can be understood as absolute path)
Next, continue to learn more commands:
ls./view all files and directories in the current directory.
Ls-a view all files, including hidden files, to the. start file.

The PWD displays the directory where you are currently located.
mkdir Create the directory, use mkdir test, and then the name of the directory after the command.
RmDir Delete Empty Directory
RM deletes files or directories, uses RM–RF test.txt (-R for recursion,-F for coercion).
CP copy file, usage, CP old.txt/tmp/new.txt, commonly used to back up; if copy directory
You need to add –r parameters.

MV Rename or move files or directories, usage, MV Old.txt new.txt
Touch creates a file, usage, touch test.txt, or, if the file exists, modifies the current file time.
Useradd Create a user, use Useradd wugk, Userdel delete a user.
Groupadd create groups, use Groupadd wugk1, Groupdel delete groups.

Find after the found directory,-name specify the name of the file you need to find, the name can use * to represent all.
find /home -name  "*.txt"; Find all files or directories that end with. txt in the/home directory.
VI modifies a file, VI has three modes:
Command-line mode, text-input mode, and last-line mode.
Default VI to open a file, first is the command line mode, and then press I into the text input mode, you can write characters in the file and so on information. After the
finishes writing, press ESC to enter command mode, and then enter: Enter the last line mode, for example, enter: Wq means save exit.
If you want to exit directly, do not save, you can do: q!, q! exclamation mark indicates forced exit.
Cat View the contents of the file, use cat test.txt to see Test.txt content
More View the contents of the file, Page view, cat is all view, if a lot of space, can only see the last space. You can use cat and more at the same time, for example: cat  test.txt |more pagination Displays the text content, | The symbol is a pipe character used to input the output of the | previous command.
Echo Echoes, use echo OK, show OK, and print whatever you type.
echo  ok  > test.txt; overwrite the OK character test.txt content,> means append and overwrite.
>> two greater than symbol, indicating append, echo OK >> test.txt, indicates appending the OK character to the Test.txt file, not overwriting the contents of the original file.
The common commands for beginners are as shown above, and of course there are a lot of deep commands to learn, followed by lectures.

2.1.3 Linux User Rights Management

In the Linux operating system, Root has the highest privileges, equivalent to the Windows Administrator, with the highest privileges to perform any command and operation. In the system, the UID to differentiate the user's permission level, the UID equals 0, indicates that this user has the highest privilege, namely the administrator. The other user UID is incremented sequentially, and the individual UID of each user can be viewed through the/etc/passwd user password file.
The permissions for each file or directory contain a user right, a group's permissions, and other people's permissions, such as the following:
Red The first root indicates that the file owner is the root user, the second root represents the group that belongs to the root group, and other users are not marked by default.
[Email protected] ~]# ls-l monitor_log.sh
-rw-r--r--1 root root 7 20:21 monitor_log.sh
[Email protected] ~]#
If we want to change the owner of a file or the group to which it belongs, you can use the command chown
Chown–r test:test monitor_log.sh can be.
Each Linux file has four access rights: Readable (R), writable (W), executable (x), and no permissions (-).
Use the Ls-l command to see the permissions for a file or directory to display the first field of data
Quasi -. The first field consists of 10 characters, as follows:
[Email protected] ~]# ls-l monitor_log.sh
-rw-r--r--1 root root 7 20:21 monitor_log.sh
[Email protected] ~]#
The first bit represents the file type,-represents the file, D represents the directory, and every three bits is followed by a group.
First group: 2-4 bits represents the permissions of the file owner, that is, user permissions, referred to as U
Second group: 5-7 bits represents the permissions of the group member to which the file owner belongs, group permission, or G
Third group: 8-10 bits represents the permissions of a user other than the group to which the owner belongs, and other permissions, referred to as O
From the above file, we can see that the monito_log.sh file corresponds to the following permissions:
The root user has read and write permissions, the root group has read permissions, and other people have read permissions.
For easier and quicker use and familiarity with permissions, rwx permissions can be represented by numbers, respectively, as R (4), W (2), X (1).
MONITOR_LOG.SH permissions can be expressed as: 644
If a file is authorized, the command is Chmod:chmod 777 monitor_log.sh

2.1.4 Linux Network configuration Management

Familiar with common commands and Linux permissions, then how do you get your Linux system online? What are the commands for managing a Linux server network?
Linux Server default NIC configuration file under/etc/sysconfig/network-scripts/, the name is typically: Ifcfg-eth0 ifcfg-eth1, eth0 represents the first Nic, eth1 represents the second NIC, and so on. The general Dell R720 Standard has 4 gigabit NICs.
To modify the IP of the NIC, you can use the command: Vi/etc/sysconfig/network-scripts/ifcfg-eth0 if it is a DHCP-acquired IP, the default configuration is as follows:
# advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
Device=eth0
Bootproto=dhcp
hwaddr=00:0c:29:52:c7:4e
Onboot=yes
Type=ethernet
If the configuration of the Ip,ifcfg-eth0 NIC is statically configured, the contents are as follows:
# advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
Device=eth0
Bootproto=static
hwaddr=00:0c:29:52:c7:4e
Onboot=yes
Type=ethernet
ipaddr=192.168.33.10
netmask=255.255.255.0
gateway=192.168.33.1
The network card parameters are as follows:
Device=eth0 #物理设备名
Onboot=yes # [Yes|no] (restart the NIC to activate the device)
Bootproto=static #[none|static|bootp|dhcp] (not using protocols | static Assignment | BOOTP protocol | DHCP protocol)

Type=ethernet #网卡类型

650) this.width=650; "src=" http://www.centoscn.com/uploads/allimg/150528/1-15052Q64RKU.png?_=5557262 "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto; "alt=" 1-15052q64rku.png?_=5557262 "/>


After the IP configuration, we can connect to the Linux server through Remote Tools, common Linux remote connection tools are: Putty, SECURECRT (mainstream), Xshell, Xmanger and other tools.
Download the installation SECURECRT, open the tool, and then configure:
Click on the top left corner quick Connect, pop-up interface, then enter the IP, username, port default is 22, and then click on the Connect connection below, will prompt for password, input can.

650) this.width=650; "src=" http://www.centoscn.com/uploads/allimg/150528/1-15052Q64S5157.png?_=5557262 "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto; "alt=" 1-15052q64s5157.png?_=5557262 "/>


Popup Enter Password box:

650) this.width=650; "src=" http://www.centoscn.com/uploads/allimg/150528/1-15052Q64T4210.png?_=5557262 "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto; "alt=" 1-15052q64t4210.png?_=5557262 "/>


Enter the remote interface, just as the server is actually logged in, and then execute the command:

650) this.width=650; "src=" http://www.centoscn.com/uploads/allimg/150528/1-15052Q64UHS.png?_=5557262 "style=" border:0px;vertical-align:middle;margin:0px auto;height:auto; "alt=" 1-15052q64uhs.png?_=5557262 "/>


After these chapters of learning, we are now proficient in the operation of Common Linux commands, rights Network, network configuration, long-distance convergence and other common sense, then what can we do next? Now that we're almost getting started, the next step is to further service provisioning, what is the Linux system for? The next chapters will come with us to learn.
The use of Linux system, we introduced the beginning of the introduction of the brief introduction, now large and medium-sized enterprises are using it to host Web sites, databases, virtual channels, and so on, then we will be in the Linux system installation of various services and software to complete the real value of Linux.

Original link: http://www.magedu.com/71755.html


This article is from the "Marco Linux Training" blog, so be sure to keep this source http://mageedu.blog.51cto.com/4265610/1927675

Linux Learning Introductory Standard Tutorial (2)

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.