Liux tip-file creation, viewing, and renaming

Source: Internet
Author: User

I have been using Linux for a while, and I feel a little bit slow. Here I am ugly and want to share some of my experiences with you! If you have any errors or have any better suggestions and ideas, please reply!

First, we will briefly introduce some files in Linux:

Linux can only distinguish the format of a file. Whether the file can be executed is irrelevant to the file suffix,

Below are some common file formats:

System File: *. cofig *. rpm. Dep

ProgramAnd script file: *. C *. php. Sh

Format File: *. wav *. jpg

Archive and compressed files: *. Tar *. GZ

The naming rules for files in Linux are somewhat different from those in Windows:

    • Case Sensitive
    • All characters except/are valid.
    • Some characters are not recommended, such as spaces or tabs.

Mkdir 123 456 creates two files: 123 and 456.

Mkdir "123 456"

The file 123 456 is created.

    • Avoid using addition or subtraction or "." As the first character of a common file. Files starting with "." are hidden files. You can use LS-a to view all files.

How to create a file:

1. Touch [Option] [file or directory]

2. Echo [file content]> file name

For example, Echo "111"> www.txtcreates an www.txt file.

Echo "111"> www.txt

3. Vim file name

Rename a file:

1.MV [Option] source file or directory target file or directory

2. RENAME [-V] [-N] [-F] perlexpr [files]

3. Modify the file name in VIM: Save the file as a command after editing: saveas filename. Change the original file name: file filename.

Supplement:

Generally, different colors are used for terminal display.

Linux File color meaningBlueRepresents a directoryGreenRepresents executable filesRedIndicates the compressed file.Light blueIndicates a link file.GrayOther filesFlashing redIndicates that the linked file is faulty.YellowIndicates the device file.

Blue (represented by D)File ---------- directory

Green ()File ---------- executable file, executable program

Red ()File ----------- compressed file or package file

Light blue (represented by L)File ---------- link file, mainly the file created by using the ln command

Gray ()File ----------- Other files

Yellow (B indicates a physical device, and C indicates a character terminal device)File ----------- Device Files

White (in-format) file ---------- general files, such as text files, configuration files, source code files, etc.

Flashing red---------- Indicates that the linked file is faulty.

File/dev/hda // View the type of the specified file Find/dev-type B // find the device-type file in the/dev directory. You can replace "B" with any type above to indicate letters, such as l and C.


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.