Frequently reviewed commands

Source: Internet
Author: User
Frequently review commands-general Linux technology-Linux technology and application information. The following is a detailed description. 1. Create a directory

Mkdir

NO1. create a multi-level directory in the current path

[Root @ rehat root] # mkdir-p mytest/test1/test1_1

NO2. grant permissions to the newly created directory while creating the Directory

[Root @ rehat root] # mkdir-m 777 testmod

In this way, anyone has any permission for this directory.
2. Copy files and folders

Cp

NO1. copy the files in the specified directory to the current directory and rename

[Root @ rehat root] # cp ~ /. Bashrc bashrc_bak

NO2. force copy the file from the specified directory to the current directory, regardless of whether the current directory contains the file

[Root @ rehat root] # cp-f ~ /. Bashrc

NO2. copy the specified directory to the current directory

[Root @ rehat root] # cp-r/root/test.

[Root @ rehat root] # cp-r/root/test /.

The two have the same effect. When copying a directory, all the last-level directories in the source path will be copied, including the directory itself.

NO3. copy files from the specified directory to the specified directory

[Root @ rehat root] # cp ~ /. Bashrc/bak/. bashrc

NO4. during replication, all the attributes of the source file are also copied. If no parameter is specified, the properties of the target file and the source file may be inconsistent.

[Root @ rehat root] # cp-~ /. Bashrc/bak/. bashrc

NO5. if two folders need to be synchronized, one file is changed and the other file is changed, but ensure that the files of both files are up-to-date.

[Root @ rehat root] # cp-u/src/. bashrc/bak_src/bashrc

3. Create a link file, including hard links and soft links.

Ln

NO1. create a shortcut similar to Windows

[Root @ rehat root] # ln-s test.txt _ slnk

NO2. if you want to back up a file with insufficient space, you can create a hard connection for the file. In this way, even if the original file is deleted

If the linked file is not deleted, it is still not deleted in the bucket.

[Root @ rehat root] # ln-l test.txt _ hlnk
4. Mount and detach a File System

Mount/umount

NO1. mount the optical drive

[Root @ rehat root] # mount-t iso9660/dev/cdrom/mnt/cdrom

NO2. mount the optical drive, supporting Chinese Characters

[Root @ rehat root] # mount-t iso9660-o codepage = 936, iocharset = cp936/dev/cdrom/mnt/cdrom

NO3. mount Windows partition and FAT file system

[Root @ rehat root] # mount-t vfat/dev/hda3/mnt/cdrom

NO4. mount Windows partition, NTFS file system

[Root @ rehat root] # mount-t ntfs-o iocharset = cp936/dev/hda7/mnt/had7

No5. mount the ISO file

[Root @ rehat root] # mount-o loop/abc. iso/mnt/cdrom

NO6. attach a soft drive

[Root @ rehat root] # mount/dev/fd0/mnt/floppy

NO7. mount a flash disk

[Root @ rehat root] # mount/dev/sda1/mnt/cdrom

NO8. mount a folder shared by the Windows operating system

[Root @ rehat root] # mount-t smbfs-o username = guest, password = guest // machine/path/mnt/cdrom

NO9. display mounted file systems

[Root @ rehat root] # mount

[Root @ rehat root] # cat/etc/fstab: displays the file system automatically loaded when the system starts.

[Root @ rehat root] # cat/etc/mtab displays the currently Loaded File System

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.