File Decompression tar
Please refer to the documentation: HTTP://BLOG.CSDN.NET/EROSWANG/ARTICLE/DETAILS/5555415/
tar -zcvf ${standardpath}${filename}. tar. GZ ${filename}
File Delete rm
RM -r/dirrmfilerm -rf/dir
-R,-R,--recursive remove directories and their contents recursively-f, -- Force-I Prompt before every removal
View Code
File copy CP
CP /sourcefile/destinationfileCP Sources/directory
-R,-R,--recursive copy directories recursively-N,--no-clobber dofile (Overrides a previous-i option)-F,-- Forceiffile cannot is opened, remove it and try again (this option was ignored when the-n option is also used)
View Code
File movement, renaming MV
mv sourcefile destfile/pathmv SourceDir Destdir
Rename Source to DEST, or move source (s) to DIRECTORY. -F,-- force does not prompt before overwriting-I,--interactive prompt before Overwrite-N,--no- clobberdofile
View Code
Change the working directory CD
CD- go back to the previous working directory~/
Create directory mkdir
mkdir dirname
-P,-- parentsif make parent directories as neededmkdir -p/path
View Code
Create a file touch
Touch file
View file path pwd
Pwd
View file size du
du -du -h/path
View the number of files in the directory
ls grep ' ^- ' WC -L
To view the number of subdirectories in a directory
ls grep ' ^d ' WC -L
View file details ls
ls ls -l / llls -ash
-A,-- all does not ignore entries starting with. -H,--human- readable-L and/or-s, print human readable sizes (e.g., 1K 234M 2G)-S,--size /c7>file in blocks-l long listing format
View Code
Find Files Find,which
Find[path] [parameter] parameter description: Time:-atime N: In Nlist of files accessed by Access within 24 hours! -ctime N: In Nchanged changes, new files or directories are printed within 24 hours-mtime N: In Nin 24 hours by modified, that is, modified files printed-newerfile: Thanfileand a new file to list! Use name:-GID N: Looking for a file with group ID n-Group name: Find a file with the name of the group-uid N: Looking for a file with the owner ID N-User name: Find a file with the user name called name-namefile: Look for the file namefilethe file name (you can use universal characters)-Type type: Look for archives with file attributes of type, type contains B, C, D, P, L, S, these are the same as the properties of the previous chapter! For example, L is the link and D is the path of meaning! which ls(which can also be found)
Find/-nametesting // Locate The file named testing Find/-name 'test* ' // Find the file that starts with test find .-ctime1 // Find new files in the current directory the next day find/home-usertest // Find file with owner test under/home
View Code
View file contents Cat,head,tail
Cat /etc/Serviceshead -n/etc/Services (view the contents of the top n rows of a file)tail -n/etc/ Services (view file n-line content) more/etc/Services (the file content will be displayed one screen at a time, you can only use the space bar to turn down)cat More command can achieve the desired effect)
View the number of rows in a file's contents
WC -l/etc/services
The above content is referenced: http://www.cnblogs.com/lanse-yan/archive/2012/11/29/2794300.html
Shell file-related directives