Share RHEL6 beginner's notes

Source: Internet
Author: User
Share with you the RHEL6 beginner's note-general Linux technology-Linux technology and application information. The following is a detailed description. This is a beginner's note for Red Hat Enterprise 6. I just learned this course and I have nothing to share with you. I only have these beginner notes. I hope they can help beginners who are just like me.



The root user is equivalent to the administrator user in windows and has high-level permissions. Unless you need to perform administrative operations, you do not need
You can log on to the system as a root user. Therefore, you can use a common user for system usage.
If you delete or add a partition, you can directly use the "# su-" command to switch to the root user.

Lpr "file" sends files to the print queue
Lprm "job number" deletes a specified print queue File
Lpq displays how many files are being printed in the print queue.
Jobs displays programs running in the background. To restore the background programs, run the following command:
Fg "number" Restore the numbered Application

Bash basic Regular Expression
\ Concatenates the text of the next line with the previous line
* Match any file
& Perform logical operations. If one & appears under the command line, it means to place an application in the background for processing. If there are two, it means
After the current command is successfully executed, the next command is executed.
-Switch to the last working directory.
# Usually used as a comment
// Usually used as a comment
~ Home Directory of each user
{Match
"" Is usually used to "consecutively" directories or file content
? Used to match a single character, number 0-9, Letter a-z

Command requirements for device files in Linux
/Dev is used to store all Device Files

/Dev/cdrom cd/dvd/cd, rw dvd, rw
/Dev/fdx local soft drive
/Dev/sdx {a .. z local serial hard drive
/Dev/sda master/serial hard drive
/Dev/sdb second fast from serial hard drive
/Dev/sdc third-Speed Master serial hard drive

/Dev/hdx {a.. z
/Dev/hda first-Speed Master-Port hard drive
/Dev/hdb second fast drive from the parallel port
/Dev/hdc third-Speed Master-Port hard drive

/Dev/sda1 first partition on the master serial port Hard Disk
/Dev/sda2 2nd partitions on the first master serial hard drive

/Dev/hda1 the first partition on the first master and Port hard disk
/Dev/hda2: 2nd partitions on the first master and Port hard drive

Master Boot Record (MBR) MBR is 512 bytes
The primary Boot Record is used to record the total number of partitions in a hard disk and the boot Partition
--------------------------------
| E |
-------------------------------------------------
| MBR | C | D | E | F | G |
-------------------------------------------------
P L




P = primary Partition
E = extended partition
L = logical Partition
MBR Size: 512 bytes
1. The primary partition occupies 128 bytes.
128x4 = 512 bytes

Extended partitions cannot be used directly.
Partitions that can be used include P and L.

Mkfs. ext4/dev/{sdx | hdx | vgname/lvname # format the partition into an ext4 file system.
Mount "/dev/sdx | hdx | vgname/lvname}/" mount point "# The mount point is an empty directory.
Df-h shows which partitions are currently mounted?
Then, if the partition needs to be automatically mounted at startup, You need to edit the following file:
/Etc/fstab is used to define which partitions can be automatically mounted after the instance is restarted? That is, the automatic Mount list.

Mount-a re-reads the/etc/fstab file. If there is a new entry in the file, it will help us mount it to our specified directory.

Umount detaches a device, which can be a U disk, a mobile storage device, or a partition ....
Cryptsetup luksFormat "device path" to encrypt the specified device
Cryptsetup luksOpen "device path" "mapper name" Unbind a partition with an encrypted password (0)
Mkfs. ext4 "/dev/mapper/" mapper name "format the opened Partition
Mount "/dev/mapper/" mapper name "/" mount point "mount the decrypted Partition
If you do not want others to read the data, you can use the permission to configure the data, or directly close the partition (encrypt) using the following command
Umount "/dev/mapper/" mapper name"
Cryptsetup luksClose "/dev/mapper/" mapper name"
If you want to decrypt the partition, repeat Step 0.
Then mount it.

If you want the partition to be decrypted and automatically mounted at startup, you will not be able to enter the system if the password is forgotten. You need to enter the rescue mode.
And the data in the encrypted partition cannot be retrieved)
Two files need to be edited
0./etc/fstab automatic mounting list
1./etc/crypttab defines the Fast File Location of the encryption device

Blkid/dev/mapper/"mapper name"

Example:
Blkid/dev/mapper/123456
/Dev/mapper/123456: UUID = "3fb1_b2-e0be-4f26-a867-48decb09cacb" TYPE = "ext4"
Copy UUID = xxxxxxxxxxxxxxx and add it to/etc/fstab.

Then update/etc/crypttab

Example:
3fb1_b2-e0be-4f26-a867-48decb09cacb "device path"

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.