Create a touch / vim / echo redirect / cat redirection
touch: Management atime, mtime
touch the file name // If the file does not exist is created, if there is to modify mtime
touch -a filename // modify the file atime
Delete 1, mv / tmp will be deleted after 30 days
2、find | xargs rm
3、rm
rm delete files
alias: rm -i (-i prompt asking whether or not to delete)
-f: Force Delete
-I: i is a time to ask, I ask only once
-r: delete the directory
--preserve-root remove the root
rmdir remove directory
mobile
File transfer has two actions: one is push, pull one is way
mv move files, rename
-t
mv abcd / e // while moving the plurality of files to / e
mv ab // modify a name for the b
Covering issues -i
cp
cp ab
cp / ab
-t
-a property can copy files directory and directory
install
-d create directories
-t
scp - command file transfer between Linux machines
Linux1 -- Linux2
Linux1: scp file root @ ip (linux2): / root /
Linux2: scp root @ ip (linux1): / file of the local directory
Seek
locate
yum install mlocate -y
Find a need to generate a library - not commonly used
updatedb we look to find the corresponding file in the library
find
You can find files based on any attributes of the file
1, inode 2, 3 file type, file permissions 4, the number of hard links 5, 6 belongs to the main belonging group 7, file size 8, 9 modification time, file name (supports wildcards and regular expressions)
-type d f s p c b l
-perm 007
Find a few levels up to -maxdepth directory
-mindepth directory to find at least a few levels
find ./ maxdepth 1 -perm +1
Exercise: do not delete files belongs to the Lord a directory
-links
find ./ -maxdepth 1 -links 2
-user -nouser
-group -nogroup
-size
-mtime -ctime -atime + - Digital
-name wildcard
Compression and recursion
Compression - only for file compression, allowing the source file smaller
gzip
bzip2
xz
Archiving - Archiving can operate on the directory, the directory will not allow smaller
takes
-j bzip2 | -J xz | -z gzip | Details -v | | -c -x (to create a decompression) -f filename Specifies the name of the compressed file is created
The best time to extract the compressed file not specified
edit
Full-screen editor
nano
you vim
1, the default command mode
i I a A o O enter the edit mode
esc to enter the last line mode
2, the command mode is commonly used techniques
h k on the left and right l j: up and down
dd delete a row 5dd delete 5 lines
Paste to paste that p np
u U cut back on a return to the operating state when entering file
yy Copy copies n rows nyy
gg cursor jumps to the first line of the file contents
G cursor jumps to the file end of the line
c=dd+i
v Visual block
ZZ save and exit
3, line mode
Many of the same operations in the line mode and sed
.,$s/^#/ /g
: $ Move the cursor to the end of the file: 1 to the first line
Seek
/ N to find the next one down a N
? Find up on a n a N
Edit multiple files simultaneously
vim a b
5DD
: Next cut in the past
p
: Prev cut back