Learning linux records

Learning linux records

View Help Help document 1, man command to view the command 2, ls --help For help with this major 3, echo $ LANG zh_CN.UTF-8 character set to adjust Shutdown and restart commands 1, shutdown -r now reboot immediately 2, reboot immediately restart 3, shutdown -h now shutdown immediately Create a file test.txt touch test.txt Delete the file test.txt rm -f test.txt Remove directory rm -fr /tmp/data Create a directory mkdir mkdir -p or / da create multi-level directory View directory contents ls ls -l use a long list format file and directory information ls -a display all files, including hidden directory ls --full -time Show full time ls - rt latest updated file directory View current directory path pwd Change directory cd cd - Change directory resides on the user's current time cd .. switch the current directory to a directory cd ../../ switch to the parent directory cd ~ switch to the current user's home directory Relative path does not begin with / absolute path begins with / Copy the file or directory cp When you copy a file to retain the same attributes cp -a Move or rename files mv vi plain text editor Normal mode Press i to enter edit mode by pressing esc back to normal mode Command Mode Display output text echo echo -n does not wrap Merge files, or view file contents cat cat -n row number starting with 1 for output of all content cat -b ignore blank line number Page display file contents more full screen display file contents more + num from the display start line number num more space to scroll down a screen more -b Scroll up a screen more / text Find specified text more -5 / etc / services 5 Pre View less page display file contents less less -N display line numbers for each line b upturned Space turn down less /etc/services Display the contents of the file header The default front display line head 10 head -n the number of lines specified head -n 5 / etc / services First 5 rows The file contents tail tail tail -n specifies the maximum number of lines After 4 row display tail -n 4 After the tail -f file changes in real-time output appended data Tail -f /appservices/access.log changes in real-time monitoring file Text filtering tools like grep Grep pattern matching parameter file lookup grep -v display line does not match grep -n matching lines and the row number display grep -o output only matched content grep -w only words that match the filter file display file types which displays the full path to the command which which -a path through all paths, the output of all the configuration items whereis command to display the full path of the file and its associated locate quickly locate the file path locate locate -c does not display the contents matching show only the number of lines find Find files in a directory find -name Find by file name find -mtime [-n | n | + n] in accordance with the modified time of the file to find the file -n time from within that file to change now n days + N that file to change the time from now n days ago n is the distance of a few days now find -type find a certain type of file b block device file c character device file d directory p pipeline l symbolic link file f regular file s socket file by D find -a intersected find -o taken and set packaged compressed tar command tar z decompressing compressed by gizp Create a new tar tar c package tar v display detailed implementation process of the tar command tar f specify the name of the compressed file tar t does not extract the tar package to view content X tar tar packets untied Specify the path tar C unzipped directory tar --exclude = excluded are not processed or packaged directory PATTERN tar -h packaged soft link file points to the real source files Display system time and date settings date -d string display time period specified character string as described, not the current time date -s date Time Set the system time complete date format date% F, equivalent to% Y-% m-% d (2019-08-19) % M (01-12) % W the first few days of the week (0-6), 0 for Monday % Y last two years % Y Year (2019) Create a user useradd Modify user information ursemod Delete users and associated user configuration or files userdel passwd set or change the password for the user su switch user roles Sudo mention an important tool for the average user rights Create a group groupadd Delete Group groupdel File permissions column r 4-readable w 2 can be written x 1 executable User group of other users rwx r-x r-x user group others chmod settings and change file and directory permissions command chmod -R recursive process specified directory and all files in subdirectories chown change file or directory users and groups command chown -R recursively change directory users and groups

  

Guess you like

Origin www.cnblogs.com/yi-xixi/p/10926943.html