Linux fourth day: Linux file Management

Source: Internet
Author: User
Tags aliases uppercase letter

Rootfs root file system root filesystem
LSB Linux Standard Base
FHS file system hierarchy Filesystem Hierarchy standard

Blue indicates directory
Green indicates an executable file
Red indicates compressed files
Light blue indicates linked files
Grey means other files
/and Nul, so the characters are valid

/boot boot file, kernel file (vmlinuz), boot loader (bootloader,grub)
/bin basic Commands
Basic commands for/sbin management classes
/lib Basic shared library, kernel module files (/lib/modules)
/lib64 shared libraries for 64-bit systems
/etc configuration file
/home/username Ordinary User Home
/root Administrator Home
/media Mobile Device Mount
/mnt Temporary File system mount
/dev device and special file storage
B Block device random access
c Character device linear access
/OPT third-party application installation
/srv data used by the system to run
/tmp temp file

/usr
Bin provides system-full functionality for Applications
Sbin Empty
Lib 32-bit
LIB 64-bit
Header files for include C programs
Share structured, independent data
Local third-party application installation
Bin, Sbin, Lib, lib64, etc, share

/var
Cache Application Caches Data directory
LIB Application state information data
Local store data for/usr/local program
Lock lock File
Log file
Opt for/opt under program store data
Run running process data, storing PID files
Spool Application Data Pool
TMP Save system Two restarts temporary data between

/proc virtual file system for output cores and processes
/sys virtual file system for output hardware devices
/selinux Security Enhanced Linux safety policy information

Binary program
/bin
/sbin
/usr/bin
/usr/sbin
/usr/local/bin
/usr/local/sbin

Library files
/lib
/lib64
/usr/lib
/usr/lib64
/usr/local/lib
/usr/local/lib64

Configuration file
/etc
/etc/directory
/usr/local/etc

Help file
/usr/share/man
/usr/share/doc
/usr/local/share/man
/usr/local/share/doc

-Normal file
D catalog File
B-Block Equipment
C-Character device
L Symbolic Link file
P Piping Pipe
s socket file socket

Centos7 Directory Changes
/bin
/usr/bin
/sbin
/usr/sbin
/lib
/usr/lib
/lib64
/usr/lib6

PWD Printing working directory current Shell CWD absolute path
CD: Go to the top level directory
CD to your home directory
Cd-to the previous directory

LS Lists directory contents
Ls-a contains hidden files
Ls-l Show additional Information
Ls-r recursion passed
Ls-ld Directory and Symbolic link information
LS-1 File Branch Display
Ls-s sort from big to small
Ls-u with-t display atime sort
Ls-u not sorted by store order display

* Match 0 or more characters
? Match any single character
~ Current User Home Directory
~username User Home Directory
~+ Current Working Directory
~-Previous working directory
[0-9] A number
[A-z] uppercase and lowercase letters
[A-z] capital letters
[WXC] matches any character in a list
[^WXC] matches all characters outside the list
Mans 7 Glob
[:d igit:] any number 0-9
[: Lower:] Any lowercase letter
[: Upper:] Any uppercase letter
[: Alpha:] any case letter
[: Alnum:] any number or letter
[: Space:] Space
[:p UNCT:] Punctuation

Stat file Status
Atime, Access time Read file contents
Mtime, modity time change file contents
CTime, change time changes the world metadata
Touch-a Change only Atime
Touch-m Change only Mtime
Touch-c not created if the file does not exist
Touch-t STAMP [[Cc]yy]mmddhhmm[ss]

Cp-i Interactive
Cp-r,-R recursive replication
Cp-a archive equals-dr--preserv=all
cp-d--no-derefernce--preserv=links Copy only links without copying source files
--preserv[=attr-list]
Mode permissions
Genus ownership group
Timestamp
Links
Xattr
Context
All
-P equals--preserv=mode,ownership,timestamp
-V--verbose
-F--force

Alias displays all aliases
Alias Name= ' VALUE ' defines aliases, current shell is valid
~/.BASHRC Current user is permanently active
/ETC/BASHRC All users are permanently active
Source/path/to/config_file
./path/to/config_file
Bash process re-reading configuration file
Unalias revoking aliases

"\command" executes the original command
' Command ' executes the original command
/path/command executing the original command

Rm-i Interactive
Rm-f Mandatory Deletion
Rm-r Recursive deletion
RM--no-preserve-root
RM-RF/

Tree-d Show only Directories
Tree-l level Specifies the display layer progression
Tree-p pattern displays only the specified matching path

Mkdir-p exist in no error can automatically build each directory
Mkdir-v Show Details
Mkdir-m MODE directly assigns permissions
Rmdir-p Recursive Delete empty directory
Rmdir-v Show Details
Rm-r recursively delete a directory tree

The Inode table contains a list of all file system files
A node contains metadata
File type, permissions, Uid,gid
Number of connections (pointing to the number of path names for this file name)
The size of the file and the different time stamps
Data block pointer to file on disk
Other data

The MV source and destination files are in the same partition,
Create a new file name corresponding to the new directory entry
Delete old file name corresponding to old directory entry
does not affect inode tables (except timestamps) or disk locations, data does not move
MV source and destination files are not in the same partition
MV equivalent to CP and RM

ln filename [linkname] Hard link
Cannot span partitions
Increasing number of connections
When deleting a file, RM decrements the number of links until 0

ln-s filename [linkname] Soft Connect
Ls-l Show Soft Links
Can be on the directory, can cross partitions,
Size is the length of the path string, without changing the number of Inode

File-b does not display file names
File-c Show Detailed procedures
File-f List File types
File-f Specify delimiter substitution ":"
File-i Output MIME string
File-l viewing soft Connection file types
File-z Interpreting Compressed Files
File--help Display online Help

STDIN-0 Standard input
STDOUT-1 Standard Output
STDERR-2 standard Error Output

> redirect stdout to a file
2> redirect stderr to file
&> Redirect all output to file

> Overwrite Files
Set-c prohibit overwrite but can append mandatory override >|
Set +C allows overwriting
>> Append

2> overriding redirect error output
2>> Weighted directional error output
COMMAND >/file.out 2>error.out respectively output to a different place
&> Right and wrong merge overlay
&>> Right and wrong merge append

COMMAND &> FILE
COMMAND > FILE 2> &1 Order is important
COMMAND >> FILE 2> &1
Find/etc-name passwd 2>/dev/null
() Merge output from multiple programs
(Cal, Cal) > All.txt

Tr-c or--complerment to take a character complement set
tr-d or--delete Delete characters
Tr-s or--squeeze-repeats the continuous repeating character as a single representation
Tr-t or--truncate-set1 converts the first character set to the second character set
Tr ' A-Z ' A-Z ' </file lowercase to uppercase
TR-D ABC </file DELETE ABC any
Cat > File Press CTRL +d to leave and use files instead of keyboard input
Cat > File << END
<< termination Words
Mail-s "Subject" User << END
>xxx
>end

COMM1 | COMM2 | COMM3 Pipeline Command
STDERR is not available for pipeline forwarding by default and can be 2>&1 or |&
The last command executes in the child shell of the current shell
Combine multiple tools
ls | Tr ' A-Z ' A-Z
COMMAND | Less per page display
echo "Test" | Mail \ S "Test" [email protected]

COMMAND | Tee FILE | COMMAND2 Redirect to multi-target

Linux fourth day: Linux file Management

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.