Linux Command summary and linux Summary
Yesterday, a friend asked me about Linux. Today, I will summarize the Linux commands.
File Operation command:
Cd: Switch Directories
Ls: displays the file or file name.
Ls-a: Show Hidden Files
Ls-l, ll + Folder: displays the content in the folder
Ls-al: Show Hidden Files
Ls-alt: sort by Time
Cp: Copy command cp a.txt/mnt to copy a.txt to/mnt
Mv: Move (CUT) mv a.txt/mnt cut a.txt to/mnt
Command for renaming: Change a.txt to B .txt in mv a.txt.
Rm: run the "rm a.txt" command to delete an a.txt file. A message indicating whether to delete the file is displayed.
-F: No prompt for deletion
-R: delete a directory.
-Rf: You can delete both directories and files without prompting
View File Content: cat view small file content: cat file name more view large file content: more File Name head view the first 10 lines of the file: head file name tail view the last 10 lines of the file: run the command mkdir: Command mkdir test to create a directory to create a test directory (folder). multiple directories can be created simultaneously: when mkdir test1 test2 creates a test1 folder and a test2 folder without an intermediate directory, mkdir-p/home/qq/test1/test2/test3 rmdir is automatically created: to delete the directory command rmdir test2 (delete an empty directory), we recommend that you use rm-rf to delete cp-r: copy the directory cp-r/test/T31mv: change the name of the mv test/mnt directory to mv test1 test user, group, and permission: -r w-r--1 root 5 Aug 5 t31.txt a total of 10 characters first character: represents type-: common file d: folder (directory) c: character file l: Link file (equivalent to the windows shortcut) 2-10 9 Characters in total: Example rwxrwxrwxR (read) w (write) x (execute) 2-4 characters: owner permission u5-7 bit: Owner's group permission g8-10 bit: others permission oChmod: Command to modify file or folder permissions 1, add permissions: chmod u + r a.txt Add read permission to the owner 2. Delete permission: chmod g-r a.txt Delete read permission to the group where the owner is located 3. Binary permission: chmod u + 400 a.txt Add read permissions to the owner (4 indicates the binary "100", corresponding to the permission "rwx", only r is 1) pwd command: displays the current or working path * wildcard, matching one or more arbitrary characters ls *. txtls *. txtcp *. txt/path/to/des/which display the complete path of a command
Which ls
Which cpwhereis list the location of a command, help manual whereis ls
Whereis cd
Vi editor uses: insert text :( command mode)-I: insert-a: append-o: open an empty line (add an empty line under the current cursor)-s: delete the current character and insert it again: (command mode)-x: one character-dw: One Word (starting from the current character and ending with the symbol)-dd: one row of Undo/restore operations-u: Undo • Save-: wq -- save the file and exit-: w file name -- save not exit • exit-: q -- exit-: q! -- Do not save and exit the search string-/-- search for the string at the end of the file -? -- Search for a string in the header direction-n -- repeat the previous string search process-N -- repeat the previous string search process in the reverse direction. Save the file as: w file name. Some common operations for vi are as follows :: $ jump to the end of the file: 1 jump to the beginning of the file to jump to the specified line: set nu set the line number for each line: line number jump to the specified line: set nonu cancel the set line number file medium use: Linux access to the optical drive: mount/dev/cdrom/mnt/aaa mount the optical drive to the/mnt/aaa directory umount/mnt/cdrom unmount the optical drive rpm: Install and uninstall the installation software suffixed with the rpm package -- version: view the rpm software version-I: Installation-h: Print # To display the installation progress-percent prints the installation progress % -- nodeps: do not check the software installation dependency, directly install-e: detach -- nodeps does not check the dependency of the software. Directly detach-q: Query-a: displays all installed rpm packages-f: displays which rpm package the file belongs to, that is Example of which rpm package is installed when this file is installed: rpm-qa queries all installed rpm packages rpm-qa | grep ...... View include "..." Field by subcontracting rpm-q ftp-0.17-17 query ftp-0.17- 17rpm-qf/bin/ls find/bin/ls file which rpm package is installed on the rpm-qi httpd-2.0.40-21 | more view httpd-2.0.40-21 package information rpm-ql httpd-2.0.40-21 | more view what files are installed in the httpd-2.0.40-21 package
Rpm-ivh ....... Rpm command to install the rpm package
Install ....... Rpm packageDisable firewall: service iptables stop
Process:
Ps-aux | grep ...... Find ...... Process ID
Kill-9 terminate a process (9 indicates the process number. Enter the number of the process to end)