Create a directory/Data mkdir/Data ls-l/data/CD/data/pwd relative path and absolute path1. Path of absolute path starting from root/Data2the relative path does not start with the current path data/create file under Data filename.txt touch/data/filename.txt Adding content to Filename.txt"I am studying Linux."method One:1.vim/data/filename.txt2. Enter edit mode Press I3Exit Edit mode Press ESC4. Save and exit: Wq5. Check cat/data/Filename.txt Method Two: Echo"I am studying Linux.">>/data/filename.txt>>Append output redirect appends the content to the end of the file>REDIRECT clears the file first, appends the content to the end of the file VI/Vim shortcut: Cut Copy paste copy current line yy paste P cut dd other action undo U recover Ctrl+r Copy the filename.txt (copy) to/TMP under CP/data/filename.txt/tmp/put/data Move To/The root directory below MV/data//root/Backup: CP filename.txt filename.txt.bak Rename: mv filename.txt Filename.avi Enter/The data directory under the root directory, delete the Filename.txt file rm filename.txt-Fman RM: View command Help find a file named Filename.txt in the system#Find/-type f-name "filename.txt" #where does find find-type F-First name ""Find/tmp-type F-name"*.txt"-type F (file)-Type D (dir) find/-type F-size +1M Find the file size larger than 1M in the root directory. The parent directory of the current directory. The current directory pipeline find command mates with other commands find+ |Xargs Find/root/-type F-name"*.log"|xargs Ls-l Find the file that ends with. Log in root, and then execute the LS-How do i print the line number and contents of the nginx.conf content of the configuration file? Seq10-1 1 >nginx.conf will be 10-1overwrite add to nginx.conf1, Cat-n nginx.conf Print file contents and print line numbers2, enter vim;: Set NU display line number set Nonu hidden line number fast reaching the last line of the file G quick to reach the first line of the file GG Quick reach a line of file 10gg recursive creation Catalog: mkdir-p/dirname/Test View only the contents of lines 20th through 30th in the Ett.txt file (total 100 rows)#awk ' nr==20 ' ett.txt#awk ' nr>=20 && nr<=30 ' Ett.txtReplacement of file contents: sed's#fileboy#filegirl#g't.sh xxx yyy file replaces xxx in files with yyy and displays#sed-i.bak ' s#fileboy#filegirl#g ' t.sh## Back up the source files first T.sh.bak## then modify the contents of the fileBackup multiple Files package compression#Create a compressed packagez = = =gzip software to compress. tar.gz C====Create Package Creation Pack V====verbose display process F====file specifies the compressed package tar ZCF/tmp/etc.tar.gz/etc/Package The ETC directory into etc.tar.gz#View Compressed PackagesTar tf/tmp/etc.tar.gz#unzip-Unzip to current directoryHow to install the Tar XF etc.tar.gz software: The Yum install package RPM packages are compiled and installed./configure make make Install
Common Linux Commands