First knowledge of Linux

Source: Internet
Author: User
Tags disk usage

With the decommissioning of April XP, and the security of Win7 and Win8, Linux systems have become increasingly popular among industries. At present, the mainstream Linux system mainly includes Redhat, Debian, Ubuntu, SuSE and so on.

1. Manage File permissions:

Both the Linux file and the directory have owners, and the owner is in a user group, which causes the file permissions to have objects. That is, three objects, for the file owner, and for the group where the owner is located, and then the other person. Permissions are divided into three types, read, write, and execute. Use the Ls–al command to view the various properties of the files in the current directory, as shown below. Where the rwx in Drwxr-xr-x represents the permission.
$ ls-al
Total 2593852
Drwxr-xr-x 153 Rd Work 8192 Jan 6 11:59.
Drwxr-xr-x root root 4096 Nov 26 2009..
-rw-r--r--1 Rd Work 59311 13 2008 0
-rw-r--r--1 Rd Work 595 Nov 0.sh
Here are 10 bits, the first one representing the file type, such as D for the directory, L for the link,-for ordinary files. The following is a continuous rwx, each three bits corresponding to the file owner, the owner group, and others, where rwx represents the read and write execution rights, and if the corresponding bit is '-' the delegate does not have the appropriate permissions.
How to change the permissions, using Chgrp,chown,chmod can change the file owner, file owner group, file permissions.

There are two important ways to use chmod. One is to use the 8 binary number mode rwxrwxrwx corresponds to 777,rw-r-r-corresponding to 644, for example chmod 777 file, another is to use the character pattern:

chmod u+x abc.sh is to increase execution permissions for the file abc.sh.
Especially worth to say is the permissions of the directory, because the directory and ordinary files are different, so the meaning of this permission is also very different. R represents the Read permission to the directory structure list, which means that with vim you can open the directory directly and see some of the file names, so use LS to list the files or directories. W means you can change the structure list of the directory so that you have many rights, such as creating a new file or directory, deleting a file or directory (ignoring its own permissions), renaming and moving files or directories. X means whether you can enter this directory as the current working directory

2. Managing Files and directories:
“.” Represents the current directory, "..." Represents the parent directory, and "~" represents the home directory.
The PWD displays the current working directory.
The CD enters the directory as the working directory.
mkdir Create a directory.
RmDir Delete Empty directory.
LS is the most common command that lists information about files in a directory.
CP copy a file or directory.
RM Deletes a file or directory.
The MV moves a directory or file that can be renamed.
Cat starts displaying the contents of the file from the first line.
The TAC is displayed from the last line, and you can see that the TAC is the cat's inverted write.
When NL is displayed, the output line number.
More paging displays the contents of the archive.
Less is similar to more, but better than more, he can page forward.
Head View first few lines
Tail view Tail Lines
OD reads the contents of the file in a binary way!
Touch changes the associated properties of a file, and a file is created when the file does not exist.
Environment variable $path Save the directory of these commands, so that typing commands do not enter the directory, the system will automatically search. The file also has many attributes, such as SUID.

3. Managing disks and file systems:
Linux standard file system for Ext2, now has EXT3,EXT4, but it supports a lot of file systems. Windows Fat16,fat32,ntfs and so on almost all of the file system, Linux can be very well supported. For Ext2, which contains the Super block, block, and inode and other data structures to ensure the normal use of the file system, the personal feel this place is more difficult to understand, the structure of these data structures and the meaning of each item is that we need to have a certain understanding of the operating system.
Each filesystem has independent inode/block/superblock and other information, these file systems are encouraged and must be connected to the directory tree to be able to be used by our normal use. This link is mount (mount). Linux is managed by the VFS (Virtual Filesystem Switch) to unify the various file systems supported by the system.
Here's a basic file system operation:
DF: Lists the overall disk usage for the file system.
Du: Calculates the disk usage of the file system (commonly used in the calculation of the directory's capacity).
LN: Create a link. There are two cases, 1. Soft connection, is often said shortcut, this kind of link is deleted or the operation will not affect the source file. 2. Hard links, this way cannot cross file system. Since the same inode information is directly referenced, modifications to it will modify the original file because the link is equivalent to the original file.
FDISK: Partitioning a disk

MKFS: Formatting the disk
Mount: Mount File system
FSCK: Used to check the file system for errors
Boot auto mount can be set in the/etc/fstab file, after the setting is complete, you must remember to use the MOUNT–A option to verify the syntax is correct.

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.