Linux Learning Notes

Source: Internet
Author: User
Tags parent directory file permissions

2017/02/09
Cat command
tab command completion and file fill function to avoid incorrect command and file name
CTRL + C kills a running process interrupt process
CTRL + D is equivalent to exit
See how to use the info date
Date Man---View the detailed use of date, through the man page, through the Q exit, the Space bar page
[Date (1)]---the meaning of the instruction that the general user can use (1)
configuration file or some file format (5)
Administrative instructions available to system administrators (8)//other skipped
Find documentation in the/user/share/doc directory

Logout Linux, exit
Linux itself has a lot of work to do, and logging in is just one of the jobs
Exit is logged in and the job is stopped, but the rest of the Linux work continues.

The correct switching machine method:
Linux, each program (service) is executed in the background, and may be at the same time more people working on your host
Abnormal shutdown may also cause damage to the file system
who--View Online numbers
Correct instructions
Shutdown and reboot two instructions
。 Sync writes data to the drive's instructions---General account updated hard disk data is its own data, root can update the entire system of data
。 Shutdown customary shutdown instructions
。 Reboot,halt,poweroff reboot, shutdown


init switch Execution level
System operation mode
Run Level0 shutdown
Run Level3 Plain text mode
Run Level5 with graphical interface mode
Run Level6 reboot
So you can also use INIT0 to shut down the machine.

Two times tab to see how many instructions can be executed

Sixth chapter Linux file permissions and directory configuration

Linux generally divides the file-accessible identities into three categories Owner/group/others

2017/02/14
2017/02/15

In Linux, all the accounts on the system, the general user, and the root information are all recorded in the/etc/passwd file.
The personal password is recorded in the Etc/shadow.
All Linux group names are recorded in/etc/group.

So do not delete it casually

Ls-al
LS display file's file name and related properties
Al lists detailed permissions and attributes for multiple files

-RWXRWX---
File type/file owner's permissions/permissions of the group to which the file resides/other people's permissions

r--readable
w--can write
x--Executable
---no permissions

File type
D indicates directory
-Presentation file
L = Link file, link file
b represents an interface device that can be stored in the device file
c indicates a serial port device in the appliance file, such as a keyboard, mouse

-rw-r--r--1 root root 176 2006-07-13. bash_profile

1---indicates that a file name is connected to the secondary node (i-node): Each file will log his permissions and attributes to the I-node in the file system
Root---Represents the owner account of the file (or directory)
root--represents the group to which the file belongs
176---File capacity size bytes
2006-07-13---File date or last modified date for this file
The. Bash_profile---file name plus. Indicates that the document is a hidden file

The importance of Linux file permissions
Features of System Protection
Team development software or data sharing capabilities

。。。 How to modify file properties and permissions


CHGRP changing the group to which the document belongs
Chown changing the owner of a document
chmod Change document permissions, Suid,sgid,sbit and other features


Permission Change method; Numbers or symbols
Digital
R:4
W:2
X:1
chmod 777. BASHRC
Symbol
chmod u/g/o/a rwx file or directory
Li: chmod u=rwx,go=rx. BASHRC
Add. BASHRC permissions that can be written by everyone
chmod a+w. BASHRC
Get rid of each person can write permissions
chmod a-w. BASHRC
The importance of permissions for documents

x file can be executed, and file name does not have any relationship
X (Access directory) for the directory, indicates that the user can enter the directory

For writable permissions, the directory
Create a new file and directory
Delete documents and directories that already exist
Renaming existing files and directories
Moving files within the directory, directory location

Linux file types and extensions
Types of Archives
1. regular file (regular file) plain text file, binary files, data format files
2. Catalog (directory)
3. link file, similar to a shortcut under Windows
4. Device and device file (device) block equipment file (block), character device files (character)
The/dev Directory
5. Information interface file (Sockets): For data on the network to undertake
6. Data transfer file (fifo,pipe): Resolves errors caused by multiple programs accessing one document at the same time


Linux Directory Configuration--FHS

1./(root root directory)

/etc configuration file
/bin (Important execution file)
/dev (Required device profile)
/lib (function library required for the execution of the file and core required modules)
/sbin (Important system execution file)

These five directories must not be separated from the root directory in separate slots


2./usr (Unix software Resource) UNIX operating system software resources: shareable and non-volatile resources
3./var is primarily for files with normal changes, including cache, login file (log file), and files generated by certain software operations.


FHS---Smaller/can be placed more concentrated and less frequent reading frequency, can avoid more errors, to help the system security


The seventh chapter, Linux Archives and directory management

Paths and directories: relative paths and absolute paths
Related Operations for Directories
. Represents this Layer directory
.. Represents a previous level directory
-Represents a previous working directory
~ Represents the "Current user status" of all home directories
~account represents the home directory of the account user

Common directives
CD Change Directory
PWD Print working directory
mkdir make Directory
RmDir

Cd
Transform Catalog
The CD ~vbird represents the user's home directory to Vbird, which is/home/vbird
Cd.. Back to Parent Directory
CD ~ Back to home directory
There is a space between the CD and the directory name

Pwd

Displays the directory where you are currently located

Linux link file
There are two types of Linux links, hard links and symbolic links, which by default produce hard links
A hard link is one that allows a file to have a valid path name so that the user can hard link to the important file to prevent accidental deletion
The real deletion condition of the file is that all hard-linked files are deleted
1. Do not allow the creation of hard links to the directory
2. Only files in the same file system can establish a connection
Soft connection
Symbolic link (symbolic Link) A shortcut file that resembles Windows is actually a text file that contains the location information for another file

mkdir (Create a new directory)


Mkdir-p TEST1/TEST2/TEST3 Create a multilevel directory (not recommended, messy)

You can use-m to give new directories new permissions without setting the system default---umask

RmDir Deleting an empty directory


Different identity users preset path, the default can be arbitrary execution of instructions are also different (root and Sun)
Path can be arbitrarily modified, so the general user can still modify path to execute some commands located under/sbin or/usr/sbin to query
Use absolute and relative paths to directly specify the file name of a command to execute, rather than searching for the correct path

LS Common parameters
-A all files, including hidden files
-A all files, including hidden files, but not included, and,, two directories
-L Long data serial, containing the properties and permissions of the archive
-d lists only the directory itself

Cp
Special attention should be paid to special permissions documents such as password files (/etc/shadow) and some configuration files when backing up the CP
Can not be copied directly, you should add-a or-p and so on to complete the permissions of the file to copy the option to


Rm
Remove Directives
Rm-r

MV Mobile files and directories, or renaming
MV test1 test2 Change file name

Get path file name and directory name
Basname and DirName


File Content Review
Cat starts displaying the contents of the archive from the first line
The TAC starts from the countdown to the first line
NL display, by the way output line number
Less and more



--------------------------------------------------------------------------------------------------------------- ----------
/* Content Paged Display */

Tools for the less tool to display pagination of files and their output

Less "parameters" file
Command parameters
-B (buffer) Set buffer size
-E (end) automatically leaves when the file display finishes
-F (Force) forced to open special files
-G only flags the last keyword searched
-I (ignore) ignores the case when searching
-m shows a percentage similar to the more command
-N (number) displays line numbers for each line
-o < file name > save less output in the specified file
-Q does not apply a warning tone
-S displays consecutive spaces as one line

-S line too long will be more than partial discard
-x< number > Displays the TAB key as a specified number space
Q Exit less command

/String Down search string
String Up search string

eg
Less Log2013.log

ps-ef|less PS View process and display with less paging

History |less Command historical usage record and show by less paging


less haha laal viewing multiple files
: N Next file
: Q Previous file


---------------------------------------------------------------------------------------------------------










Head remove first few lines head-n number file name
Tail tail-n Number file name after removing several lines

Remove a paragraph of text from a file
Head-n 3 File Address |tail-n 5
OD non-plain text file
Od-t type file name

Touch modify file time or create a new file

Modification Time (Mtime)
When the contents of the file are updated, the new time between
Status Time (CTime)
When a permission or property is changed, the time between
Access Time (Atime)
When the contents of the file are taken, it will be updated at this time

Umask File Preset Permissions
Specifies the default value of the current user's permissions when creating the file or directory


Which looking for execution documentation

Eighth Linux disk and file system management





The Nineth Chapter archives and file system compression and packaging


1. Compress the document to reduce the disk capacity used by the archive by compressing the original file through some algorithms. Compression ratio
2. Compression can reduce the waste of disk capacity
3. Extension of the compressed file name:. tar,.tar.gz,.tgz,.gz,. z,.bz2
4. Recommended use of bzip2!!
5.tar can be used for file packaging, gzip support and BZIP2
6.dump can back up a file system or a single directory
7.dump Backup for file system, 0-9 level differential backup, level0 for full backup
8.restore Restore the backup file created by dump

Linux Learning Notes

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.