1.Linux release system naming and directory names use
2. metadata information file which, respectively, what is the meaning, how to see? How to modify the file timestamp information
1. The metadata file is a property, file size, creation time, access time, is the information of the main group metal and the like.
2. The three timestamp:
access time: access time, abbreviated atime, read and write file contents
modify time: modification time, mtime, change the contents of the file (data)
change time: change time, ctime, metadata change
3. Modify the timestamp file: touch
touch - change file timestamps
touch [OPTION]... FILE...
-c: not create the specified file path does not exist;
-a: Modify only access time;
-m: Modify only modify time;
-t STAMP
[[CC]YY]MMDDhhmm[.ss]
Example:
3. Summary soft and hard-wired connection differences, illustrated by an example and
Illustrates the difference between hard and soft connection
Conclusions on hard links
- A plurality of files with the same inode number of the hard-linked files to each other;
- Delete hard-linked files or delete any one of the source files, the entity has not been removed;
- Only delete source files and all corresponding hard link file, the file will be deleted entity;
- Hard-linked files is another entry documents;
- It can prevent important files from accidental deletion by setting a hard link to the file documents;
- Ln order to create a hard link source file hard-linked files;
- Hard link file is an ordinary file can be deleted with rm;
- For static files (no process is called), when the number of hard links to 0:00 file is deleted. Note: If the process is called, you can not delete or even if the file name is deleted but space will not be freed.
Conclusions on soft link
- Soft links to similar shortcuts windows system;
- Soft link is stored inside the source file path, to the source file;
- Delete files, soft links still exist but can not access the source file contents;
- When a link failure is generally soft white on red flashing;
- Create a soft link command ln -s source file of the soft link file;
- Soft links and source files are different files, file types are different, inode numbers are different;
- Soft link file type is "l", be deleted with rm.
The difference between a hard link and soft link
In principle, the same inode number of hard links and source files, both hard links to each other. Inode number of different soft connection and source files, in turn, points different from the block, the soft block stored in the connection path name of the source file.In fact, the hard links and source files is the same document, and the flexible connection is a separate file, like shortcuts, store the source file location information to facilitate orientation.Use the limit, you can not create the directory hard links, you can not create hard links to a different file system, you can not create a hard link to a file that does not exist; you can create a soft link to the directory, you can cross-file system creates the soft link, can not exist create a soft link file.
[root@VM_0_15_centos ~]# ll -i
total 6728
394681 -rw-r--r-- 1 root root 6888896 Nov 10 21:42 a
394522 lrwxrwxrwx 1 root root 1 Nov 10 21:45 a.link -> a
[root@VM_0_15_centos ~]# cat a.link
cat: a.link: No such file or directory
[root@VM_0_15_centos ~]# ll -i
total 13456
394681 -rw-r--r-- 3 root root 6888896 Nov 10 21:42 a
394681 -rw-r--r-- 3 root root 6888896 Nov 10 21:42 a.hard
394522 lrwxrwxrwx 1 root root 1 Nov 10 21:45 a.link -> a
[root@VM_0_15_centos ~]# ll -i
total 13456
394699 -rw-r--r-- 2 root root 6888896 Nov 10 22:39 a.bak
394699 -rw-r--r-- 2 root root 6888896 Nov 10 22:39 a.hard
394522 lrwxrwxrwx 1 root root 1 Nov 10 21:45 a.link -> a
[root@VM_0_15_centos ~]# tail a.hard
999991
999992
999993
999994
999995
999996
999997
999998
999999
1000000
1
File Management command on the 4.Linux what are its common usage and its associated example shows
Directory Management command:
cd,, ls,mkdir, rmdir, tree
cd
cd command to change the working directory to dirname. Wherein dirName representation may be an absolute or relative path.
Syntax: cd [directory name]
Command options:
-p To switch to the target directory is a symbolic link, switched directly to the target directory is a symbolic link
-L If the target directory is to be handed over a symbolic connection, switch directly connected to the directory character delegates, rather than the symbolic link points to the target directory.
- When the only practical "-" is an option, the current working directory will be switched to the directory environment variable "OLDPWD" it represents.
Popular formats:
cd into the user's home directory;
cd ~ into the home directory;
cd - to return before entering the directory where the directory;
return to parent directory cd .. (If the current directory is "/", is also performed after the "/"; ".." to mean the parent directory);
cd ../ .. return two directories; the parameters $ cd command is used as a parameter cd!
Example:
Cd to / opt / rh directory
[root@localhost opt]# cd /opt/rh
[root@localhost rh]# pwd
/opt/rh
Return to parent directory using the cd ..
[root@localhost rh]# pwd
/opt/rh
[root@localhost rh]# cd ..
[root@localhost opt]# pwd
/opt
Use cd ../ .. return to the two directories
[root@localhost rh]# pwd
/opt/rh
[root@localhost rh]# cd ../..
[root@localhost /]# pwd
/
ls
linux ls command is the most commonly used commands. ls command is the list of abbreviations, by default ls used to print out a list of the current directory, if ls specify a different directory, it will display the specified directory list of files and folders.
By ls command you can not only view the file linux folder contains the file permissions and can be viewed (including directories, folders, file permissions) to view the directory information and so on.
Format: ls [options] [directory name]
Command options:
-a, -all to list all files in the directory, including Implied beginning of the document
With -A -a, but not listed "." (Current directory), and ".." (indicating a parent directory of the current directory).
-c with -lt: sort and display with according to ctime (time of last file status change) ctime
-l: show ctime but otherwise Sort by name: Sort by ctime
-C items listed from top to bottom of each column
-color [= WHEN] control whether the color resolution file. WHEN may be 'never', 'always' or 'auto' one
-d, -directory will show the same directory as the file, rather than the files in the display.
-D, -dired produce results for the dired mode used Emacs
-f output file is not sorted, -aU option takes effect, -lst options fail
-g similar -l, but do not list owner
-G, -no-group does not list any information about groups
-h, -human-readable format file sizes listed readily appreciated (e.g. 1K 234M 2G)
-si similar -h, but the file size of 1000 to take power rather than 1024
-H, -dereference-command-line using the real destination of the command line symbolic link indicated
-indicator-style = specify the name of each item in the indicator plus <mode>: none (default), classify (-F), file-type (-p)
-i, -inode print inode number of each file
-I, -ignore = print style does not conform to any shell wildcard characters <style> project
-k i.e. -block-size = 1K, the size of the file represented in the form of k bytes.
-l In addition to the file names, permissions, owner, file size and other information will be detailed in the file.
When -L, -dereference when the symbolic link file information display, a display object indicated by the symbolic link information symbols rather than the link itself
-m all items separated by commas, and fill the entire width trekking
Similarly -o -l, details other than the outer set of information about the file.
-r, -reverse arranged in reverse order by
-R, -recursive layer also lists all subdirectories
-s, -size block size to the size of all files listed in units
-S sort based on file size
-sort = WORD following are the optional WORD and appropriate options they represent:
extension -X status -c
none -U time -t
size -S atime -u
time -t access -u
version -v use -u
-t file modification time to sort
-u with -lt: show access time and sort by access time
With -l: show access time but sort by name
Otherwise: sort by access time
-U do not sort; list the items according to the original order of the file system
-v sorted according to the version
-w, -width = COLS own screen width specified without using the current values
-x list items line by line instead of by-column lists
Sort by extension -X
-1 list only one file per line
-help display this help and exit
-version Display version information and exit
Command parameters: Directory: Specify the directory listing to be displayed, it can be a specific file.
Example:
Displays the current non-hidden files and directories under the shadow directory
[root@localhost /]# cd /boot
[root@localhost boot]# ls
config-3.10.0-327.el7.x86_64
grub
grub2
initramfs-0-rescue-80b038a43aa0449c844ba01e218186d5.img
initramfs-3.10.0-327.el7.x86_64.img
initramfs-3.10.0-327.el7.x86_64kdump.img
initrd-plymouth.img
symvers-3.10.0-327.el7.x86_64.gz
System.map-3.10.0-327.el7.x86_64
vmlinuz-0-rescue-80b038a43aa0449c844ba01e218186d5
vmlinuz-3.10.0-327.el7.x86_64
A list of all files in the current directory, including hidden files, including shadow
[root@localhost boot]# ls -a
.
..
config-3.10.0-327.el7.x86_64
grub
grub2
initramfs-0-rescue-80b038a43aa0449c844ba01e218186d5.img
initramfs-3.10.0-327.el7.x86_64.img
initramfs-3.10.0-327.el7.x86_64kdump.img
initrd-plymouth.img
symvers-3.10.0-327.el7.x86_64.gz
System.map-3.10.0-327.el7.x86_64
vmlinuz-0-rescue-80b038a43aa0449c844ba01e218186d5
vmlinuz-3.10.0-327.el7.x86_64
.vmlinuz-3.10.0-327.el7.x86_64.hmac
Long list of output formats
[root@localhost boot]# ls -1
config-3.10.0-327.el7.x86_64
grub
grub2
initramfs-0-rescue-80b038a43aa0449c844ba01e218186d5.img
initramfs-3.10.0-327.el7.x86_64.img
initramfs-3.10.0-327.el7.x86_64kdump.img
initrd-plymouth.img
symvers-3.10.0-327.el7.x86_64.gz
System.map-3.10.0-327.el7.x86_64
vmlinuz-0-rescue-80b038a43aa0449c844ba01e218186d5
vmlinuz-3.10.0-327.el7.x86_64
The level of output file list
[root@localhost boot]# ls -m
config-3.10.0-327.el7.x86_64, grub, grub2,
initramfs-0-rescue-80b038a43aa0449c844ba01e218186d5.img,
initramfs-3.10.0-327.el7.x86_64.img,initramfs-3.10.0-327.el7.x86_64kdump.img,
initrd-plymouth.img, symvers-3.10.0-327.el7.x86_64.gz,System.map-3.10.0-327.el7.x86_64,
vmlinuz-0-rescue-80b038a43aa0449c844ba01e218186d5,vmlinuz-3.10.0-327.el7.x86_64
Detailed lists of files and folders
[root@localhost boot]# ls -l
The total amount of 94804
-rw-r--r--. 1 root root 126426 11月 202015 config-3.10.0-327.el7.x86_64
drwxr-xr-x. 2 root root 26 12月 1000:21 grub
drwx------. 6 root root 104 12月 1000:24 grub2
-rw-r--r--. 1 root root 45390555 12月 10 00:23initramfs-0-rescue-80b038a43aa0449c844ba01e218186d5.img
-rw-------. 1 root root 19744484 12月 10 00:24initramfs-3.10.0-327.el7.x86_64.img
-rw-------. 1 root root 17671172 12月 10 00:26initramfs-3.10.0-327.el7.x86_64kdump.img
-rw-r--r--. 1 root root 602601 12月 1000:22 initrd-plymouth.img
-rw-r--r--. 1 root root 252612 11月 202015 symvers-3.10.0-327.el7.x86_64.gz
-rw-------. 1 root root 2963044 11月 202015 System.map-3.10.0-327.el7.x86_64
-rwxr-xr-x. 1 root root 5156528 12月 1000:24 vmlinuz-0-rescue-80b038a43aa0449c844ba01e218186d5
-rwxr-xr-x. 1 root root 5156528 11月 202015 vmlinuz-3.10.0-327.el7.x86_64
[root@localhost boot]#
Listed in chronological file and folder details
[root@localhost boot]# ls -lt
The total amount of 94804
-rw-------. 1 root root 17671172 12月 10 00:26initramfs-3.10.0-327.el7.x86_64kdump.img
drwx------. 6 root root 104 12月 1000:24 grub2
-rw-------. 1 root root 19744484 12月 10 00:24initramfs-3.10.0-327.el7.x86_64.img
-rwxr-xr-x. 1 root root 5156528 12月 1000:24 vmlinuz-0-rescue-80b038a43aa0449c844ba01e218186d5
-rw-r--r--. 1 root root 45390555 12月 10 00:23initramfs-0-rescue-80b038a43aa0449c844ba01e218186d5.img
-rw-r--r--. 1 root root 602601 12月 1000:22 initrd-plymouth.img
drwxr-xr-x. 2 root root 26 12月 1000:21 grub
-rw-r--r--. 1 root root 252612 11月 202015 symvers-3.10.0-327.el7.x86_64.gz
-rwxr-xr-x. 1 root root 5156528 11月 202015 vmlinuz-3.10.0-327.el7.x86_64
-rw-r--r--. 1 root root 126426 11月 202015 config-3.10.0-327.el7.x86_64
-rw-------. 1 root root 2963044 11月 202015 System.map-3.10.0-327.el7.x86_64
[root@localhost boot]#
Display folder information
[root@localhost boot]# ls -ld /root
dr-xr-x---. 14 root root 4096 12月 11 17:14 /root
mkdir
mkdir command to create the directory specified by name, asked to create a user directory have write permission in the current directory, and specify the directory name can not be the current directory has a directory.
Syntax: mkdir [options] directory ...
Command options:
-Z: set the security context, the SELinux effective when used;
-m <target attribute> or --mode <target Properties> Settings directory permissions while building directory;
--parents -p or if the parent directory to create the directory is not yet established, will together establish the parent directory;
--version display version information.
Command parameters: Directory: Specify the list of directories to be created, separated by a space between multiple directories.
Example:
Created in the / tmp directory: a_c, a_d, b_c, b_d
[root@localhost tmp]# mkdir -v {a,b}_{c,d}
mkdir: create directory has "a_c"
mkdir: create directory has "a_d"
mkdir: create directory has "b_c"
mkdir: create directory has "b_d"
(2) create / tmp / directory under mylinux:
mylinux /
├── bin
├── boot
│ └── grub
├── dev
├── etc
│ ├── rc.d
│ │ └── init.d
│ └── sysconfig
│ └── network-scripts
├── lib
│ └── modules
├── lib64
├── proc
├── sbin
├── sys
├── tmp
├── usr
│ └── local
│ ├── bin
│ └── sbin
└── was
├── lock
├── log
└── run
[root@localhost tmp]# mkdir -vpmylinux/{bin,boot/grub,dev,etc/{rc.d/init.d,sysconfig/network-scripts},lib/modules,lib64,proc,sbin,sys,tmp,usr/local{bin,sbin},var,lock,lock,log,run}
mkdir: create directory has "mylinux / bin"
mkdir: create directory has "mylinux / boot"
mkdir: create directory has "mylinux / boot / grub"
mkdir: create directory has "mylinux / dev"
mkdir: create directory has "mylinux / etc"
mkdir: create directory has "mylinux / etc / rc.d"
mkdir: create directory has "mylinux / etc / rc.d / init.d"
mkdir: create directory has "mylinux / etc / sysconfig"
mkdir: create directory has "mylinux / etc / sysconfig / network-scripts"
mkdir: create directory has "mylinux / lib"
mkdir: create directory has "mylinux / lib / modules"
mkdir: create directory has "mylinux / lib64"
mkdir: create directory has "mylinux / proc"
mkdir: create directory has "mylinux / sbin"
mkdir: create directory has "mylinux / sys"
mkdir: create directory has "mylinux / tmp"
mkdir: create directory has "mylinux / usr"
mkdir: create directory has "mylinux / usr / localbin"
mkdir: create directory has "mylinux / usr / localsbin"
mkdir: create directory has "mylinux / var"
mkdir: create directory has "mylinux / lock"
mkdir: create directory has "mylinux / log"
mkdir: create directory has "mylinux / run"
[root@localhost tmp]# tree mylinux/
mylinux /
├── bin
├── boot
│ └── grub
├── dev
├── etc
│ ├── rc.d
│ │ └── init.d
│ └── sysconfig
│ └── network-scripts
├── lib
│ └── modules
├── lib64
├── lock
├── log
├── proc
├── run
├── sbin
├── sys
├── tmp
├── usr
│ ├── localbin
│ └── localsbin
└── was
23 directories, 0 files
rmdir
rmdir command to delete empty directories. When a directory is no longer in use, or the use of disk space has reached the limit, you need to delete the directory lose value. Note: Before subdirectories be deleted should be empty directory. That is, all the files in that directory with the command rm all must, in addition, the current working directory must be deleted on the directory, the directory itself can not be deleted, nor can it be deleted subdirectory of the directory.
Format: rmdir [options] directory ... ..
Command options:
-p or --parents: After deleting the specified directory, parent directory if the directory has become an empty directory, and then delete one;
--ignore-fail-on-non-empty: This option allows to ignore the error message because the rmdir command to delete non-empty directories when due;
-v or -verboes: show implementation details of the command;
--help: Displays help information about the command;
--version: show the version of the command.
Command parameters:
Directory list: List empty directory you want to delete. When deleting multiple empty directory, use the directory name separated by a space.
Example:
Subdirectory test3 test2 under the deleted
[root@localhost tmp]# tree test2/
test2 /
└── test3
1 directory, 0 files
[root@localhost tmp]# cd test2
[root@localhost test2]# rmdir test3
[root@localhost test2]# cd ..
[root@localhost tmp]# tree test2
test2
0 directories, 0 files
Delete subdirectories and its parent directory test1 test2
[root@localhost tmp]# tree test/
test/
└── test1
└── test2
2 directories, 0 files
[root@localhost tmp]# cd test
[root@localhost test]# rmdir -p test1/test2
[root@localhost test]# cd..
[root@localhost tmp]# tree test/
test/
0 directories, 0 files
tree
tree command to list the contents of a directory tree view.
Format:
tree [options] directory ...
Command options:
-a: shows all files and directories;
-A: using tree ASNI drawing character display ASCII characters rather than in combination;
-C: In the list of files and directories plus color, easy to distinguish the various types;
-d: First, the directory name rather than content;
-D: Change the time listed in the file or directory;
-f: Before each file or directory, display the full relative path name;
-F: In the implementation files, directories, Socket, symbolic links, piping name names, each coupled with "*", "/", "@", "|" number;
-g: When listing the name of the file or directory belongs to a group, without a corresponding name, group identification code is displayed;
-i: not a step-like list file and directory names;
-l: <template Style> style no symbol template file or directory name;
-l: In case of a directory is a symbolic link properties, the original directory listed directly to the connection points;
-n: do not add color to the list of files and directories;
-N: Direct lists file and directory names, including control characters;
-p: list the permissions marked;
-P: <style templates> displays only the file and directory names conform to style templates;
-q: No. replace with control characters listed in the file and directory names; "?"
-s: list the size of files and directories;
-t: Sort by modification time of files and directories;
-u: lists the name of the owner of the file or directory, when no corresponding name, user identification code is displayed;
-x: the limited range of the existing file system, if certain subdirectories under the specified directory, which is stored in another file system, the directory to be excluded from the scope of looking outside.
Command parameters:
Contents: instruction execution tree, it will list all the files in the specified directory, including subdirectories in the file.
Example:
All files in the directory View mylinux
[root@localhost tmp]# tree mylinux/
mylinux /
├── bin
├── boot
│ └── grub
├── dev
├── etc
│ ├── rc.d
│ │ └── init.d
│ └── sysconfig
│ └── network-scripts
├── lib
│ └── modules
├── lib64
├── lock
├── log
├── proc
├── run
├── sbin
├── sys
├── tmp
├── usr
│ ├── localbin
│ └── localsbin
└── was
23 directories, 0 files
NOTE: If no tree command to install, you can install the yum package tree line,
the command: # yum install tree -y
Text file viewer class command:
cat, tac,more, less, tail,head
cat
Format: cat [option] [file] ...
Command options:
-n or -number: 1 start number for the number of lines for all outputs;
-b or --number-nonblank: -n and similar, but not number blank lines;
-s or --squeeze-blank: when faced with more than two consecutive lines of the blank lines, one line on the blank line substitution;
-A: unprintable character display, the display end of line "$";
-e: equivalent to "-vE" option;
-t: equivalent to "-vT" option;
Command parameters:
File list: Specifies a list of files you want to connect.
tac (reverse listed)
Anti-tac is cat written over, so contrary to his function like cat, cat by the first row to the last row are continuously displayed on the screen, and tac is the last line to the first line by the reverse displayed on the screen !
Format: tac [options] [file] ...
Command options:
-a or --append: will append to the end of the file;
-i or --ignore-interrupts: ignore interrupt signal.
Command parameters:
File list: Specifies a list of files to be saved content.
more
Format: more [options] [file] ...
Command options:
- <number>: Number of lines per screen display;
-d: Display "[pressspace to continue, 'q' to quit.]" and "[Press 'h' for instructions]";
-c: not scroll operation. Each time you refresh the screen;
-s: a plurality of blank lines into one line display;
-u: Turn underline;
+ <Number>: Displays the specified number of lines.
Command parameters:
File: Specifies the page display file contents.
less
More action and less command is very similar, can be used to browse the contents of a text file, the difference is less command allows the user to browse the file forward or backward, and the more command can navigate forward. Display command file using less, PageUp keys with Page Up, Page Down keys with PageDown. To exit the program less, should the Q key.
Format: less [options] [file] ...
Command options:
-e: display file contents is completed, automatically exit;
-f: Force display the file;
-g: do not highlight all the keyword search to show only the ones that are showing, in order to speed up the display;
-l: Ignore differences sensitive search;
-N: each trekking first display line numbers;
-s: a plurality of consecutive blank lines into one line display;
-S: show a longer single-line content, without a new line display;
-x <number>: TAB will appear as a space character specified number of characters.
Command parameters:
File: Specify the split-screen display file contents.
tail
For the tail contents of the input file. tail end of the 10 command line specifies the default display files on the screen. The front of each document if a given file is more than one display plus a file name title. If you do not specify a file or file name is "-", standard input is read.
Note: If you represent a "+" sign before the value of N bytes or number of lines from the beginning of the file item N began to show, rather than displaying the last N items in the file. Suffix after the value N may be: b represents 512, k represents 1024, m represents 1048576 (1M).
Format: tail [options] [file] ...
Command options:
--retry: that is, when the tail command to start the file or files to become inaccessible later inaccessible, are always trying to open the file. In conjunction with the required option "--follow = name" when using this option;
-c or --bytes =: the output end of the file N (N is an integer) bytes of content;
-f or; - follow: displays the contents of the file date added. "Name" represents a way of monitoring changes in the file name of the file. "-F" and "-fdescriptor" equivalent; -F: when used in conjunction with the same options "-follow = name" and "--retry" function;
-n or --line =: tail output file N (N digits) row of content.
--pid = <process ID>: with the "-f" option is used in conjunction, when the number of processes specified process terminates automatically exit the tail command;
-q or --quiet or --silent: When there are a plurality of parameter files, each file name is not output;
-s <seconds> or --sleep-interal = <seconds>: and "-f" option is used in conjunction, the number of seconds specified change monitoring time interval of the file;
-v or --verbose: When there are multiple parameter files, each file name always outputs;
--help: display help information instruction;
--version: show the version information of the instruction.
Command parameters:
File list: Specifies the list of files to display the contents of the tail.
head
head command is used to display the contents of the beginning of the file. By default, head command displays the first 10 lines of the file contents.
Format: head [options] [file] ...
Command options:
-n <number>: Number of lines displayed head of the content;
-c <characters>: Specifies the number of characters of the head of the content display;
-v: Always display the header information of the file name;
-q: does not display the header information of the file name.