02-linux Basic Introduction (II)

Source: Internet
Author: User
Tags clear screen

One, the order
Commands that must be mastered:
Man,touch,ls,mkdir,cp,rm,mv,echo,pwd,cat,alias,unalias,head,tail,tree,rmdir
Want to get high-tech command to master: Find,xargs,awk,sed,grep,vi,vim,seq
Second, the Linux system to view the means of command help
①man command name/configuration file (detailed help), summary notes, need to be viewed in detail.
② Command--help (a little simple help), quickly check a command.
③ search engine "Linux command name", keyword Linux cat command.
④HELP command name, Special Bash get help method for built-in commands.
Man can't find a command to find with help!
Third, special characters
| Pipeline
.. Top level Directory
. Current directory
/The vertex of all directories, and also the delimiter for the path.
; The command delimiter.
{} generates a sequence of characters or numbers, similar to SEQ, typically used with commands such as Echo, and the {} in Find means the result of the preceding command.
About!
①! The + letter indicates the most recent command that starts with this letter.
Ii!! Represents the use of the most recent operation.
③! + number indicates the first command to bring up history.
④~ the home directory of the current user.
⑤-the directory where the user was last located-controlled by the OLDPWD variable.
⑥ inversion (Find,shell programming)
⑦&& and, and
Add:
Find-type file type (f (file), D (directory), C (character), B (Block), S (socket)),-name "filename",-mtime time, search by modified time, time number, +7 7 days ago, 7 Seventh Day,-7 last 7 days.
! Inverse,-A and intersection, and,-o or set or.
Four, common shortcut keys
①☆tab command or path completion, Linux is the most useful shortcut keys, if the Tab is not the path or command, it means that there is no such path or command, there may be permissions are not correct.
②ctrl+c terminates the current task command or program.
③ctrl+d exits the current user environment, which is equivalent to Exit,logout.
④ctrl+l clear screen, equivalent to clear.
⑤ctrl+shift+c (ctrl+insert) SSH client securecrt copy the command.
⑥ctrl+shift+v (Shift+insert) The command pasted in the SSH client securecrt.
⑦ctrl+a to the beginning.
⑧ctrl+e to the end.
⑨ctrl+u clears the command from the current cursor position.
⑩ctrl+k clears the command from the current cursor position.
? Ctrl+w clears the current line.
? Ctrl+r Search.
V. Viewing system-related information
① Viewing the system version
[Email protected] ~]# cat/etc/redhat-release
CentOS Release 6.9 (Final)
② Viewing the system kernel
[Email protected] ~]# uname-r
2.6.32-696.el6.x86_64
③ See 32-bit systems or 64-bit systems (often ask you this question during an interview: What are the differences between 32-bit and 64-bit systems?) )
[Email protected] ~]# uname-m
x86_64
④ View all information
[Email protected] ~]# uname-a
Linux centos6 2.6.32-696.el6.x86_64 #1 SMP Tue Mar 19:29:05 UTC x86_64 x86_64 x86_64 gnu/linux
⑤ Display host Name
[Email protected] ~]# uname-n
Centos6
Vi. Setting the host name
hostname display and set hostname default is display host name, set hostname can hostname name (temporary effect)
Vii. about Partitioning
In a hard disk, partitions are divided into primary partitions, extended partitions, logical partitions. The number of primary partitions + extended partitions <=4, where one primary partition can be replaced with an extended partition, and the extended partition can have at most one. An extended partition cannot be used directly, and a logical partition can be created above, with multiple logical partitions. The primary partition + extended partition number can only be 1-4, and the logical partition number can only start at 5.
? Common partitioning schemes
1. General partitioning: Data is not a particularly important business (such as a node in a cluster)
/boot boot partition 200M primary partition
Swap swap partition Memory 1.5 times times, memory is greater than 8G, give 8-16g
/Linux all directory vertices all remaining space
2. Data is important (database, storage server)
/boot boot partition 200M primary partition
Swap swap partition Memory 1.5 times times, memory is greater than 8G, give 8-16g
/Linux all directory vertices, 100-200g
/data all, store data
3, mega-website, portal (special product line, demand)
/boot boot partition 200M primary partition
Swap swap partition Memory 1.5 times times, memory is greater than 8G, give 8-16g
/Linux all directory vertices, 100-200g
The remaining space is not allocated, which department receives the server and partitions according to the requirements.
? Disk partition naming and Numbering methods
(1) Naming the device
In Linux systems, disk devices correspond to special files in the system, which are placed in the "/dev" directory, and the device names for different devices are as follows:
0 System's first IDE interface hard disk is called/dev/hda
0 System's second IDE interface hard disk is called/DEV/HDB
0 System's first SCSI interface hard disk is called/DEV/SDA
0 System of the second SCSI interface of the hard disk is called/DEV/HDB
(2) using a numeric number
To represent different partitions, numbers are usually numbered, such as:
The 1th partition of the first IDE interface hard disk of the 0 system is called/DEV/HDA1.
The 5th partition of the first IDE interface hard disk of the 0 system is called/DEV/HDA5.
The 1th partition of the second IDE interface hard disk of the 0 system is called/DEV/SDB1.
The 5th partition of the second IDE interface hard disk of the 0 system is called/DEV/SDB5.
It is important to note that when partitioning numbers, the number 1~4 can only be left to the primary or extended partition, and the logical partition (which is based on the extended partition) can only start with the number 5.
After partitioning the Linux system, you also create the file system on the partition to install the driver, which is done by the system on its own at the time of installation.
VIII. Application Management of Linux system
? About Command Introduction
Useradd Add user syntax: Useradd user Name, example: Useradd Zhangyujia
passwd set or modify password syntax for the user: passwd Zhangyujia sets the password for the Zhangyujia. Direct passwd is the current user's password change.
1. Add a regular user account
Useradd Zhangyujia
2. Set password for ordinary user account
passwd Zhangyujia
Advanced Method-Non-interactive Change password: echo "123456" |passwd--stdin Zhangyujia
3. Switch User Roles
Su-zhangyujia
4. See what the current user is
WhoAmI
5, cut back to the root user
Su-root
Tip: In general, in the enterprise production environment should try to avoid direct to the root user operation, unless there is more than the normal user rights of the system maintenance needs, the use of the end immediately back to ordinary users.
Ix. temporary modification of the Linux command prompt
Set |grep PS1
PS: If you want to make permanent changes, you need to change the/etc/profile file (later in the article to say it)
(not to be continued ...) )

Welcome attention
Sina Weibo: https://weibo.com/yougazhang0506
Public platform: Zhang Yujia

My site: http://www.zhangyujia.cn
51CTO Blog: http://blog.51cto.com/11099293
CSDN Blog: http://blog.csdn.net/u013260195

02-linux Basic Introduction (II)

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.