Linux Learning Summary (v)-linux file system and related commands

Source: Internet
Author: User
Tags parent directory

Http://www.lxway.com/505469826.htm
There are many references to the above linked articles written below

A Linux File system overview

Linux system architecture is different for WinDOS, he is a tree-like file system, under Linux we call everything file, we will be a directory, can be called directory files.
Linux has only a single top-level directory structure. Everything starts with root, with a '/' representation, and extends to subdirectories. Dos/windows have different partitions at the same time directories are stored on the partition. Linux puts all the partitions in a directory that is set up under root by ' loading '. The closest thing to root under Windows is C:. Bottom line: Under Windows, the directory structure belongs to the partition; Under Linux, the partition belongs to the directory structure. Under Windows, different partitions are detected at startup and assigned a partition letter. Under Linux, unless you load a partition or device, the system will not know the existence of that partition. This may not seem to be the most convenient way to access a partition or device, but he offers great maneuverability.
Take a look at the architecture of the Linux tree-like file system

Two Linux directory files in a detailed

Let's look at the entire catalogue below
/root directory, all files under him
/bin storing the necessary commands such as LS cat CP
/boot storage System kernel and boot required files we saw grub in him.
/dev Store device files such as my hard drive,/dev/hda Optical drive/dev/cdrom
Serial port/dev/tty Just said everything is file, access to the device is access to the file directory is access to the device's entrance
/etc Storage System configuration files, all system management required configuration files and subdirectories
Like/etc/profile/etc/bash.rc.
Home directory of user files, equivalent to WinDOS under C:\Users, each user has a directory of their own, usually the directory name is named after the user's account, such as/root/lv-linux
The former is the root user, the latter is the normal user
/lib storage is the most basic system of dynamic connection shared library, which acts like a DLL file in Windows, almost all applications need to use these shared libraries
/proc This directory is a virtual directory, is a mapping of system memory, we can obtain the system information through direct access, storage process and system information
/usr contains applications that generally do not need to be modified, command program files, libraries, manuals, and other documents, similar to the Programs files directory under Windows, where many of the users ' applications and files are stored in the directory
/media system automatically identifies the mount points of peripherals such as the U-disk
/mnt temporary mount points for users, storing temporary mapping file systems, we often mount the floppy drive and CD drive in the floppy and CDROM subdirectories here
/opt the directory that is set by the additional installation software, which is empty by default. For example, you can install MySQL database here
/sbin:s is the meaning of super user, which is the system administrator used by the System management program
/usr/bin: This directory holds applications that are used by system users.
/usr/sbin: This directory holds the more advanced hypervisor and system daemon used by super users.
/USR/SRC: This directory is the default drop directory for the kernel source code.

Three: Introduction to several file types

Input Ls-l
The first character of the first column is the file type
' d ' indicates that the file is a directory;
'-' indicates that the document is an ordinary document;
' L ' indicates that the file is a linked file (Linux file) and the soft link mentioned above is the type;
' B ' means the file is a block device, such as/DEV/SDA.
' C ' indicates that the file is a serial port device, such as a keyboard, mouse.
' s ' means that the file is a socket file (socket) for interprocess communication.

Four CD commands

Relative path and absolute path:
For example, there are two ways you can go from home to the company:
1: You from home to the subway station, and then to the company, this road from home to go through the complete walk is the path
2: You happen to walk in the park near the company, at this time to the company, you do not need to go home, this is the relative path
Vi/etc/sysconfig/network-scripts/ifcfg-ens33
The path is the absolute path, which is found from the root
For example, I can find the operation above
First Cd/etc/syconfig/network-scripts
Then execute VI ifcfg-ens33 and then the VI is followed by the relative path.
If you look at the cat ifcfg-ens33 under the/root, it won't be possible.
Because there is no file in the current directory, you have to be honest and cat/etc/sysconfig/network-scripts/ifcfg-ens33.
What do you think of my current directory, PWD can
Here are some of the CD usage
1 CD-Returns the last directory executed two times back to the current target
2 CD ~ Go to the user home directory, such as you are currently logged in as root user, and go to other directory you can CD ~ to/root
3 CD. Go back to the parent directory, such as you are now in the/etc/sysconfig/network-scipts directory
You execute the CD. It's just under the/etc/sysconfig, and then it's going to/etc

Five mkdir rmdir rm ls command

1 mkdir Creating a directory
For example, I create a python directory under the root directory
Mkdir/python, you can.
If I want to create a duplex directory, create a/python/program under the root
You can CD to Python under mkdir program
You can also directly execute mkdir-p/python/program
2 rmdir Deleting a directory
RmDir can only delete non-empty directories if the containing file cannot be deleted
Rmdir-p can only delete non-empty duplex catalogs,
Example: Mkdir-p/123/456/789
At this point rmdir-p/123/456/789 can be deleted all
If Touch/123/456/789/a.txt
Rmdir-p cannot delete any files at this time
If Touch/123/a.txt
Rmdir-p can be deleted/456/789 reserved/123/a.txt
3 RM Delete files and directories
RM does not follow parameters can only delete files, cannot delete directory
RM-RF can delete any directory or file
such as Touch/123/456/789/a.txt
Rm/123/456/789/a.txt can be deleted a.txt other directories are reserved
Touch/123/1.txt/123/456/2.txt/123/456/789/3.txt
At this time with Rm-r/123/456/789 can delete 3.txt and 789 directories, to be prompted to enter two times Yes
rm-rf/123/456/789 Delete all
With v parameter RM-RFV you can see the execution process
4 ls command
LS is the list of the meaning of listing the contents of the file, below I introduce several uses:
Ls-a Show All files and directories (see View to hidden files)
-L is displayed in long format with only one display per line
-I displays the file index node number (inode). An index node represents a file
-T from near sort display by file modification time
-D displays only the directory name, not the list of contents under the directory. Displays the symbolic link file itself without displaying the list of directories it points to
-H to visually display file sizes
-C LS default output with no parameters, multi-column display
Example: Ls-al | grep ' ^d ' shows all directories

Linux Learning Summary (v)-linux file system and related commands

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.