Linux Common Command Practice

Source: Internet
Author: User

First, the boot automatically mount file system settings

    1. Create a new Rhel directory under/media and mount the/DEV/SR1 second optical drive to that directory

#mkdir/media/rhel

#mount/dev/sr1/media/rhel

    1. Automatically mount file system settings on boot

/DEV/SR1 boot automatically mounts to/media/rhel by modifying the file Mount table/etc/fstab

Restart the computer: #init 6, and then through the command: #df –H to see if the optical drive SR1 can be automatically mounted on the boot.

Ii. Create and delete soft and hard links under Linux

1. Create a new test directory under/Under testing, then create a new file in the directory file1, File2, and write the characters to these 2 files via the VI command: this is file1/file2!

#mkdir/test

#touch/test/file1

#touch/test/file2

#vi/test/file1//Input characters: this is file1

#vi/test/file2//Input characters: this is file2

2. Enter directory/test to create a hard-link file in the current directory for the File1 file Hardfile1

#cd/test

#ln file1 Hardfile1

#ls –il//Compare the I node number and capacity size of file1 and hardfile1 files, conclusion: same

# ln File1/tmp/hardfile1//For file1 to create a hard-link file in the/tmp directory Hardfile1:

# LS–IL/TMP//See if hard-link files are created successfully

#vi/tmp/hardfile1//view File1 file contents via hard link file

#rm –rf/test/file1//delete original file file1

#vi/tmp/hardfile1//The contents of the File1 file can still be accessed through VI or CAT commands

Conclusion: Hard links are just different file names of the same file, sharing the same I-node number.

3. Enter directory/test to create a soft link file in the current directory for the File2 file Softfile2

#cd/test

#ln –s file2 Hardfile2

#ls –il//Compare the I node number and capacity size of file2 and softfile2 files, conclusion: different

# Ln/test/file2/tmp/softfile2//For file2 to create a soft link file in the/tmp directory Softfile2:

# LS–IL/TMP//See if the soft link file was created successfully

#vi/tmp/softfile2//view File2 file contents via a soft link file

#rm –rf/test/file2//delete original file File2

#vi/tmp/softfile2//The contents of the File2 file cannot be accessed through the VI command or the cat command

Conclusion: As long as the original file is deleted, the soft link file cannot find the original file, so soft link is just a shortcut.

Third, Modifying network parameters with the VI command

Assign the IP address to the system's first NIC Eth0:192.168. X. 1/24, the gateway is: 192.168. X. 254,dns address is: 192.168. x. 1, where X is the last 2 digits of his own study number, assuming that the number is number 100th:

#vi/etc/sysconfig/network-scripts/ifcfg-eth0

#service Network restart//Restart networking service

#ifconfig eth0//See if the modified network parameters are in effect

Third, shutdown, restart computer command

1. Restart command

Init 6 or reboot

2 Shutdown command

Init 0 or halt

To create a hard connection:

To create a soft connection:

Network configuration:

Linux Common Command Practice

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.