The basic operation of the file has a lot of scattered commands, do a small summary, basically divided into create, view, link, package compression, find
Create :
mkdir: Creating a Directory
mkdir [-P build multi-level directory] [-m set permissions simultaneously]
Mkdir-p/test/test
MKDIR-M 774 Test
Touch: Create File/modify file time parameter
Touch [-A modify access time to current time] [-C Modify permissions and content modification time to current time] [-m Modify specific content modification time to current time] [-t modified to specified time] filename
Access time: When the file was last accessed
View: ll--time=atime filename
Status time: The state of the file, that is, metadata permissions and properties last modified
View: ll--time=ctime filename
Modification time: The date when the file's content was recently modified
View: ll filename, default is display Mtime
The format of the-t parameter is: YYMMDDHHMM
Example: Touch 150110161010 filename//change to January 10, 15 16:10 10 seconds
To view the contents of a file:
1:cat [-A lists all special characters] [-b Lists line numbers except blank lines] [-n lists all line numbers] [-s removes blank lines]
2:more: Flip to view
/string//Can be searched
: F can list travel number and file name
3:less: Can flip, more useful than more
/string//Down lookup
? string//Up Lookup
Pageup/pagedown//Up/down page
n/n//Backward Find Next/forward Find Next
4:head: View the first 10 lines of a file
Head-n [3 show top three rows] [-3 followed by three lines not shown]
5:tail: 10 lines after viewing files
Tail-n [3 display after three lines] [+3 front three lines not shown]
Package Compression: Tar
Tar [-C new Package file] [-X extract] [-v Display processing content] [-Z compressed by gzip] [-j compressed by bzip2] [-F compressed file name] [-C unzip the specified extract directory]
General usage:
Compression: TAR-JCVF filename.tar.bz2
Decompression: TAR-XVF filename.tar.bz2-c extract to which directory//general no longer specify-J parameters, decompression will be completed automatically
Two packaging formats:
Gzip:*.tar.gz
bzip2:*.tar.bz2
To Create a link :
ln [-S Create soft link, default is hard link] Source file link file
1: Soft Link/symbolic Link: equivalent to a shortcut, the block of a soft connection file is a link to the upper directory inode that points to the real file
2: Hard Link: Hard link and source file in the block table of the upper directory, all point to the inode of the actual same real file
650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>
Find:
1:which: Finding where to execute files
2:locate: Find files through database records, can be queried by some file names
3:whereis: Finding files from database records
UpdateDB command to update the database
Find the file name within the disk with/etc/updatedb.conf settings and update the/var/lib/mlocate
The locate command finds the Input keyword file name based on the database in the/var/lib/mlocate
4:find
and the differences through database queries: Find is directly found by disk
More information about the Find command: http://boxinknown.blog.51cto.com/10435935/1663910
This article is from the "Call Me boxin" blog, so be sure to keep this source http://boxinknown.blog.51cto.com/10435935/1663912
Simple operation of files under Linux (Create, view, link, package compress, find)