Quick Query manual for common Linux/UNIX commands

Source: Internet
Author: User
Tags ftp login pdf manual ftp hostname
It took me two days to sort it out, and some of the most common commands that people on Earth know would be skipped! Finally, download the pdf manual. command to change the archive owner: chown [-cfhvR] [-- help] [-- version] user [: group] file... function: change the file...
It took me two days to sort it out, and some of the most common commands that people on Earth know would be skipped! Finally, download the pdf manual. command to change the archive owner: chown [-cfhvR] [-- help] [-- version] user [: group] file... function: change the file or folder owner parameter format: user of the new file owner IDgroup: user group of the new file owner-c: if the archive owner has changed, the change action is displayed.-f: If the archive owner cannot be changed, do not display an error message.-h: only link is changed, rather than the file that the link actually points to-v: displays the details of the owner's change-R: change the owner of all files and sub-directories in the current directory one by one (that is, change one by one) for example: chown-R oracle: oinstall/oracle/u01/app/oracle change the directory owner to oracle 2. command: chmod (c Hange mode) function: changes the read/write and execution permissions of files. The signed method and the octal digit method. Option: (1) syntax: command format: chmod {u | g | o | a} {+ |-|=}{ r | w | x} filename u (user) indicates the user himself. G (group) indicates the same group of users. O (oher) indicates other users. A (all) indicates all users. + Permission granted to a specified user. -Cancels the permission granted to a specified user. = Grant the permitted permissions to the file. R (read) indicates that the content of the file or directory can be copied. W (write) write permission indicates that the content of the file or directory can be modified. X (execute) indicates that you can execute the file or enter the directory. (2) octal digit method: command format: chmod abc file where a, B, and c each have an octal digit, indicating the permissions of User, Group, and Other respectively. 4 (100) indicates readable. 2 (010) indicates writable. 1 (001) indicates executable. If the rwx attribute is required, 4 + 2 + 1 = 7; if the rw-attribute is required, 4 + 2 = 6; if the r-x attribute is required, 4 + 1 = 5. For example, # chmod a + rx filename allows all users to read and execute the file filename. # Chmod go-rx filename: cancel the read and execute file filename permissions of the same group and other users. # Chmod 741 filename allows you to read and write files, read files from the same group of users, and execute files from other users. # Chmod-R 755/home/oracle recursively change the directory permission. you can perform read/write operations, read/write operations on the same group of users, and read/write operations on other users. 3. run the "touch format: touch filenae" command to modify the file date. do not modify the file content. if the file does not exist, create a new file. Example: % touch file 4. link file command: ln (link) format: ln [option] filename linkname ln [option] directory pathname function: creates a chain for a file or directory. Filename and directory are the source file name and source directory name. linkname and pathname indicate the files or directories linked to the source file or source directory name respectively. Option:-s creates a symbolic link for a file or directory. If-s is not added, a hard link is created for a file or directory. note: The Link aims to assign more than two names to a file or directory so that it can appear in different directories, you can share files or directories and save disk space. Example: % ln-s filename linkname 5. display date command: date for example: % date 6. run the "Show calendar" command: cal (calendar) format: cal [month] year function: displays the specified calendar for a year, for example, % cal 1998 7. command for displaying the file header: head format: head [option] filename function: Display the file header options: by default, the first 10 lines of the file are displayed. -I: displays the start line of the file. Example: % head filename 8. tail command: tail format: tail [option] filename function: Display the end of the file option: the last 10 lines of the file are displayed by default. -I: displays the last line of the file. + I is displayed from row I of the file. For example, % tail filename 9. command for displaying user IDs: id format: id [option] [user] function: displays user IDs and all groups to which users belong. Option:-a displays the user name, user id, and all group notes of the user, for example, % id username 10. view the currently logged-on user command: users 11. display who is logged on to the machine command: who format: who function: display all the usernames in the system currently, using the terminal device number, registration time. Example: % who 12. display the user name command on the current terminal: whoami format: whoami function: displays the users used on the current terminal. Example: % whoami 13. file search command: find FORMAT: find pathname [option] expression function: find a file that matches the expression under the given channel name. Option:-name indicates the file name-user username. select the file-size to which the user belongs and search by size. the unit is block, A block is 512B-mtime n, which is queried based on the last modification time, select the modified file in n days-perm search by permission-type search by file type-atime search by last access time for example: % find. /-name '* abc *'-print 14. search file match command: grep format: grep [option] pattern filenames function: searches the specified file or standard input line by line, and displays each line of matching mode. Option: ignore case-v when matching-I to find out the line with mode mismatch, for example, % grep-I 'Java *'. /test/run. sh 15. word count command: wc [option] filename function: used to count the number of lines, characters, and characters in a file. Option:-l number of rows in the statistics file-w number of words in the statistics file-c number of characters in the statistics file note: If the default file name is used, the standard input is % wc-c. /test/run. sh 16. disk space Display Command: df (disk free) format: df [option] function: displays the usage of disk space, including the directory name, block device name, total bytes, used bytes, and percentage of remaining bytes installed on the file system. Option:-a: displays all file systems and disk usage of each partition-I: displays I-nodes usage-k: The size is represented by k (default) -t: displays the disk usage of all partitions in a file system-x: displays the disk usage of all partitions not in a file system-T: display the name of the file system to which each partition belongs-h: indicates the output using "Human-readable", that is, the file system size uses readable formats such as GB and MB. Note: for example, % df-hi 17. disk space command for querying files or directories: du (disk usage) format: du [option] [filename] function: the unit is the subdirectory in the specified directory, show the disk space occupied by all files in each directory option:-a: displays the disk space occupied by all directories and each file in the second Directory-B: the size is represented by bytes (the default value is k bytes)-c: add the total (default value)-s: only display the total size of each file-x: calculate only files of the same file system-L: Calculate all files-h: indicates that the file system size is in a readable format such as GB and MB. For example, % du-a % du-sh/etc only displays the total % du/etc of the Directory. | sort-nr | more: sort the statistical results using the sort command, the-nr parameter of sort indicates that reverse sorting is performed by numerical sorting. 18. display process Command: ps format: ps [option] function: displays information about processes in the system. Including process ID, control process terminal, execution time, and command. Option: -a: displays all processes.-U uidlist: lists all processes of the user.-e: displays information about each running process.-f: displays a complete list.-x: displays processes without terminal control. status. Note: for example, % ps-ef % ps-aux is then directed to grep with a pipeline symbol to find a specific process and then operate on the specific process. 19. terminate the process Command: kill format: kill [option] pid function: send a signal to the specified process or terminate the process. The purpose of the kill Command is to send a signal to a process, because most of the messages are sent to kill the SIGKILL or SIGHUP of the process, so it is called the kill option:-9 forcibly terminate the process. note: pid indicates the process number, which can be obtained by the ps command. For example, % kill-9 pid, you can also use kill-l to view the number words that can replace signal number. For more information about kill, see man kill. 20. view your own IP address command: ifconfig format: ifconfig-a 21. view route table command: netstat format: netstat-rn 22. remote logon command: telnet hostname 23. file transfer command: ftp (file transfer program) format: ftp hostname function: network file transfer and remote operations. Option: ftp command: cd [dirname] enter the remote machine directory LCD [dirname] set the local machine directory dir/ls to display the remote directory file bin for binary transmission asc for text file transmission get /mget retrieves one or more files from the remote machine put/mput and sends one or more files to the remote machine. when prompt is enabled or multiple files are closed, the interaction prompt is "close ". quit ftp! /Exit ftp login status ,! Indicates that the ftp is temporarily exited and the local directory is returned. the exit indicates that the ftp status is returned. note: % ftp hostname 24. view your own email command: mailx format: mailx option: delete next quit exit reply 25. recall command: history format: history function: helps users recall executed commands. Option: Comment: for example: % history 26. online conversation command: talk format: talk username function: chat with another user online. Option: Note: During a dialog, the system divides the terminal into the upper and lower parts. the upper half displays the information you typed, and the lower half displays the information you typed. Type delete or Ctrl + C to end the dialog. Example: % talk username 27. command to allow or reject message sending: mesg (message) format: mesg [n/y] function: allows or rejects other users to send information to their own terminal. Option: n deny other users to write information to their terminals y allow other users to write information to their terminals (default value) Note: % mesg n 28. command: write format: write username [ttyname] function: write information to terminals of other users. Option: Note: If the recipient does not refuse, the dual-user can talk. type EOF or Ctrl + C to end the conversation. Example: write username 29. create, modify, and delete users and groups. create a group: for example, groupadd oinstall creates a group named oinstall groupadd-g 344 dba creates a group with a group number of 344. in this case, a group ID (GID) is generated in the/etc/passwd file) is a project of 344. B. modify group: groupmod: this command is used to change the attributes of the user group account groupmod-g new GID user group account name groupmod-n new group name Original Group name: this command changes the user group name c. delete group: groupdel Group name: this command is used to delete the specified group account d. create a user: command: useradd [-d home] [-s shell] [-c comment] [-m [-k template] [-f inactive] [-e expire] [-p passwd] [-r] main parameter-c: add the remarks text and save the remarks text in the remarks column of passwd. -D: specify the start directory when the user logs on. -D: change the default value. -E: specifies the validity period of the account, which is permanently valid by default. -F: specifies the number of days after the password expires. -G: specifies the group to which the user belongs. -G: specify the additional group to which the user belongs. -M: automatically creates a user's logon directory. -M: do not automatically create a user's logon directory. -N: cancel the creation of a group named by the user name. -R: create a system account. -S: specifies the shell used after the user logs on. -U: specifies the user ID. Example: # useradd-g oinstall-G dba oracle create Oracle User e. command to delete a user: userdel user name to delete the specified user account userdel-r user name (userdel user name; rm user name): delete the specified user account and the home directory example: # useradd-g root kkk // add the kkk user to the root Group f. modify user command: usermod modify existing user information usermod-l old username new username: modify usermod-L username: used to lock a specified user account, make it unable to log on to the system usermod-U username: Unlock the locked user account passwd-d username: leave the account without a password, that is, the user can log on to the system without a password. example: # usermod-l user2 user1 // rename user2 to user1 30. enable or disable a firewall Close chkconfig iptables on chkconfig iptables off takes effect immediately: after restart, restore service iptables start service iptables stop or:/etc/init. d/iptables start/etc/init. d/iptables stop 31. start VSFTP immediately:/etc/init. d/vsftpd start:/etc/init. d/vsftpd stop default VSFTP service automatic start: Method 1: (common \ convenient) [root @ localhost etc] # chkconfig -- list | grep vsftpd (check the situation) vsftpd 0: off 1: off 2: off 3: off 4: off 5: off 6: off [root @ localhost etc] # chkcon Fig vsftpd on (execute ON settings) or: Method 2: modify the file/etc/rc. local: insert/usr/local/sbin/vsftpd & into the file to enable automatic start upon startup. 32. vi tip a. enter the input mode to add (append) a: add data from the end of the cursor position, and move the data after the cursor along with the new data. A: add data at the bottom of the column where the cursor is located. Insert I: insert data from the front of the cursor. the data after the cursor is moved to the backend with the new data. I: insert data starting from the first non-blank character in the column where the cursor is located. Open o: Adds a column under the column where the cursor is located and enters the input mode. O: add a new column to the column where the cursor is located and enter the input mode. B. exit vi. in command mode, type: q,: q !,: Wq or: x (note: No.), the vi will be exited. Where: wq and: x are stored and exited, while q is directly exited. if the file has a new change, vi will prompt you to save the file and the q command will also be invalid, in this case, you can use the w command to save the file and then use q to exit, or use the wq or x command to exit. if you do not want to save the changed file, you need to use: q! Command to exit vi without saving the file. C. command for deleting and modifying files: x: delete the character where the cursor is located. Dd: delete the column where the cursor is located. R: modify the character where the cursor is located and the character to be corrected after r. R: Enter the retrieval and replacement status. The new text will overwrite the original text until you press [ESC] to return to the command mode. S: delete the cursor character and enter the input mode. S: delete the column where the cursor is located and enter the input mode. D. screen tumble command Ctrl + u: Ctrl + d: Ctrl + f: Ctrl + B: flip a screen at the beginning of the file nz: roll line n to the top of the screen. if n is not specified, roll the current line to the top of the screen. E. delete command ndw or ndW: delete the n-1 words "do" at the beginning of the cursor and the n-1 words "do" at the end of the line: delete to the beginning of the line d $: delete to the end of the line ndd: delete the current row and its n-1 rows x or X: Delete a character, x delete the cursor, and X delete the Ctrl + u before the cursor: delete text entered in input mode f. search and replace command/pattern: search pattern from the beginning of the cursor to the end of the file? Pattern: Search for pattern n from the beginning of the cursor: Repeat the previous search command N in the same direction: Repeat the previous search command in the opposite direction: s/p1/p2/g: replace all p1 in the current row with p2: n1, n2s/p1/p2/g: Replace all p1 in line n1 to n2 with p2: g/p1/s // p2/g: Replace all p1 files with g. copy and paste (1) selected text blocks, use v to enter the visible mode, move the selected content of the cursor key (2) copy the selected block to the buffer, use y; copy the entire row, use yy (3) to cut the selected block to the buffer, use d; cut the entire row and use dd (4) to paste the content in the buffer, and use p h. open the second file in the same editing window, use: sp [filename] to switch between multiple editing files, and use Ctrl + w
Linux_unixcommonly used command to quickly find the album .rar http://up.2cto.com/2012/0326/20120326023519180.rar
Author cuishen
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.