Linux common command learning record
Brothers Linux training
, the editor has sorted out the commonly used Linux learning commands:
1 cp copy command
Parameters : -p file attributes are copied together
-r copy folder
-d soft chain information, etc. are copied together
-a is the abbreviation of -rdp
2 find file search Command
Common search by file name (exact search)
find /home -name xx.xx
common branch file name search (fuzzy match, support: ? (single character), * (multiple characters), [] (specific content in brackets match))
find /home -name "*.xx" all files ending
with
.xx Find /home -user sls0919 Find all files of user sls0919
Find /home -nouser Find no owner in the home directory Files (probably junk files) find /home -size +25k
according to the file size Find files
larger than 25k in the home directory (plus sign means greater than, minus sign means less than, no symbol means equal) Find /home
according to the file date
-mtime +25 Find files modified 25 days ago in the home directory (plus sign means greater than, minus sign means less than, no symbol means equal; mtime: content modification time, atime: access time, ctime: modification attribute time)
multi-condition search Connection symbols (a==and, o==or)
find /home -mtime +25 -a-size -25k Find files in the home directory that were modified 25 days ago and whose size is less than 25k
find /home -mtime +25 -o -size-25k Find the content modified 25 days ago in the home directory Or files with a size less than 25k After
querying the results and executing the operation command (-exec {}\;)
find /home -mtime +25 -a-size -25k -exec ls -lh {}\; List 25 days in the home directory Details of files whose content was previously modified and whose size is less than 25k
3 grep text search command
-i ignore case
-v exclude the specified string
-c count the number of times the specified string is found
-n the output result shows the line number
grep -r 'test' * Search for files with 'test' line in the current directory and its subdirectories
grep -l -r 'test' * Search for files with 'test' line in the current directory and its subdirectories, but do not display matching lines, only display Matching files
grep -n 't[ae]st' data.txt Find test or tast information in the file data.txt (refer to regular expressions for details)
4 man and help Help commands
man ls
ls --help
5 zip, gzip, bzip2, tar compression and decompression commands
zip compressed file name source file
-r compressed directory
Both gzip and bzip2 are compressed files and cannot be used for directories.
Common methods:
tar -cvf compressed file name source file source file source file can be multiple
-c compression
-x decompression
-v show the compression process
-f specify the packaged file name
-z Compress and decompress .tar.gz type files
-j compress and decompress .tar.bz2 type files
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=326474246&siteId=291194637
Recommended
Ranking