Brother even Linux training
, a small compilation of common Linux learning Commands:
1 CP Copy command
Parameter:-p file attributes are copied together
- r Copy Folder
- D Soft chain information, etc. copy together
-A is a shorthand for -rdp
2 Find File lookup commands
Normal search by file name ( exact lookup )
Find/home-name xx.xx
General Branch file name lookup ( fuzzy Matching, support:? Single character ),* ( multiple characters ),[] ( matches a specific content in brackets) )
find/home-name "*.xx" all files ending with . XX
Find based on the user who owns the file
Find/home-user sls0919 Find all Files sls0919 the user
Find/home-nouser Find files without owner in home directory ( Approximate rate is junk file )
Find by File size
find/home-size +25k find files larger than 25k in home directory ( plus sign is greater than, minus indicates less than, no symbol equals )
Find by File date
find/home-mtime +25 Find files modified in the home directory ( plus sign is greater than, minus is less than, no symbol equals ; mtime) : Modify content time,atime: Access time,ctime: Modify attribute time )
Multi-criteria Lookup connection symbol (A==and,o==or)
find/home-mtime +25-a-size-25k Find files that were modified in the home directory and smaller than 25k in size
find/home-mtime +25-o-size-25k Find the contents of the home directory modified or smaller than 25k file size
Query the results and execute the action command (-exec {}\;)
find/home-mtime +25-a-size-25k-exec ls-lh {}\; List details of files modified in the home directory and smaller than 25k in size
3 grep Text Lookup command
-I ignores case
- v excludes the specified string
- C calculates the number of times the specified string was found
- n output shows line number
grep-r ' Test ' * searches the current directory and its subdirectories for files of ' test ' lines
grep-l-R ' Test ' * searches the current directory and its subdirectories for files of ' test ' lines, but does not display matching rows, showing only matching files
grep-n ' t[ae]st ' data.txt find information for test or tast in file data.txt ( refer to Regular expression )
4 man and help command
Mans LS
LS--help
5 zip, gzip, bzip2, tar compress unzip command
Zip Compressed file name source file
- R Compression directory
gzip and bzip2 are both compressed files and cannot be on the directory
Common methods:
TAR-CVF Compressed file name source file source file source file can be multiple
- C Compression
- x Decompression
- v Show compression process
- F Specifies the file name after packaging
- z compression decompression . tar.gz Type File
-j Compression decompression . tar.bz2 Type File
Linux Common Command Learning record