Unix command detailed

xiaoxiao2021-03-06  91

Unix command detailed

Www.r8r8.com 2002-8-12 Yonglian

The UNIX command details only the basic usage of each directive, if you need to explain, use the man to read detailed manual. A. Directs for file / directory processing: 1. Ls This is the most basic file instruction. The meaning of the LS is "List", which is displayed in a directory or a certain file. If you are not followed by any file behind the LS command, it will show all the files in the current directory. You can also add the name or file of the directory you want to see behind the LS, such as the% ls / home2 / x11r5% LS First LS has some special parameters, you can give users more information, as follows: -a: If a directory or the first character of a directory or file name is ".", Use LS will not display the name of this file, we call this file as a hidden file. Such as TCSH's initial settings .tcshrc; if we want to see such files, you must add parameters -a. -l: This parameter represents long (long) format using LS, you can display more information, such as file access, file owner (Owner), file size, file last update date, even Symbolic Link files is LINK That file, etc. The following% ls -l drwx - x - x 2 jjtseng 512 AUG 8 05:08 18Drwx - x - x 2 jjtseng 512 Aug 8 22:00 19-RW ------ 1 Jjtseng 566 Aug 8 05:28 makefile 2. The meaning of this instruction is replication ("Copy"), that is, copy one or more files into another file or copy it to another directory. The Usage of the CP is as follows: CP F1 F2: Copy the file name F1 to file a file name F2. CP F1 F2 F3 ... DIR: Put the file F1 F2 F3 ... all copied in the same file name in the directory DIR. CP -R DIR1 DIR2: All content of DIR1 is copied to Dir2. There are also some parameters as follows: -i: This parameter is when the file has been named F2, if the CP will cover the original F2 content, so you must ask the user before you have to cover it. a bit. If the user's answer is Y (YES), the copying action is performed. -r: This parameter is used to make backup replication, and you can copy a whole subtree into another directory. 3. The meaning of MVMV is MOVE, mainly to change a file to another directory. As with CP, it also has three formats: MV F1 F2: Change the file name F1 into files named F2. MV DIR1 DIR2: Change the directory named DIR1 to the directory named DIR2. MV F1 F2 F3 ... Dir: Move file F1 F2 F3 ... all in the directory DIR. The parameters of the MV have two, -f and -i, where the meaning of -i is the same as the CP, all of the interactive query. And -f is forced (force), no matter whether there is a file with the same name, anyway, I am going to move, all other parameters encountered -f will fail. 4. The meaning of RMRM is REMOVE, which is used to kill a file instruction. A file that is killed in Unix unless the system is just a backup, otherwise it is unable to save it like DOS. So when doing RM actions, users should be particularly careful. The format of the RM is as follows: RM F1 F2 F3 ..... and RM parameters are commonly used: -f, -i, and -r -f: will make the system when deleting, no warning messages . -i: You will ask if you want to remove it before removing the file. -r: Removal deletion.

Be careful not to use rm -rf, otherwise you will "cry without tears" ... 5. MKDirmkdir is a directive that makes users build a directory. You can use MIDIR under a directory to create a subdirectory, the method used is as follows: Mkdir DirName1 [DirName2 ...] You can create one or more directories. 6. CHDIR (CD) This is to let the user used to transfer the work catalog. The use of ChDIR is as follows: chDIR DIRNAME You can transfer the current directory to DirName. Or use "chdir .." to transfer to the previous layer directory. 7. RMDIR is used to kill an "empty" directory relative to Mkdir. If there is no file below a directory, you can remove it with the RMDIR instruction. RMDir's usage is as follows: rmdir dirname1 [dirname2 ....] If there are other files under a directory, RMDIR will not be able to kill this directory unless the RM instruction is used. 8. PWDPWD Displays the path (PATH) of the current directory, for example: 9. CAT / more / less or more of the above three instructions are instructions to view the contents of the file. Cat's meaning is cat .... No, CONCATENATE, in the Dictionary meaning "link, smashed" (language electronic dictionary cdict), is actually displaying the contents of the file meaning. Cat has a lot of strange parameters, which is often used by the -n parameters, which is to add the displayed content. The use of CAT is as follows: CAT [-n]: Self-written content, you can use PIPE to turn other programs to Cat .cat [-n] filename: Read FileName's content, displayed in standard output on. The problem is that CAT is not stopped, so it is not easy to use (if a screen is twenty-four lines, and a file is 400 lines, Cat will come out, it will be rolled up, the user is very It is difficult to get the information they need. So someone wrote more more. More, followed by Cai Wenneng Teacher, "more good", more can put the observed files followed by the form of the terminal, and then change the page or row according to the user's request. If the user wants to search for a specific string in a certain file, press / and then follow the words to be searched to search. More can also be found. The use of more is as follows: More filename If you feel that you have seen it is seen, you can use 'Q' to leave more. Press 'V' in use or you can use the editor to edit the viewed file. The usage of Less is similar to more. It was originally designed to make up for more than the shortcomings of the pages. The usage of Less is as follows: Less filename It is different from more that it can be rolled up by Y, and can you use "?" to search for the single word you want to find. 10. ChmodchMod is the change model. This instruction is used to change the access mode of the file. On a file of UNIX (R), writable (W) can be performed (X), respectively, with the owner of the file, the group member (you can ls -lg Watch the group of a certain file, and others. A file If you change to an executable mode, the system will treat it as an executable file, and a directory executable represents the user's right to enter the directory.

CHMOD is used to change some files. The way of use is as follows: chmod [-fr] mode filename ... The meaning of its parameters is as follows: -f force. Chmod will not pay the failure. -R Recurive. All subdirectories and files under all subtrands will be changed to the mode you have to change. MODE can be a three or four-digit eight-in number to represent the access to certain objects. For details, please refer to the explanation of Absolute Modes in the Manual Page of CHMOD (1). Or use a string to indicate, please refer to CHMOD (1). b. About Process processing instructions: 1. PSPS is used to display the status of your Process or system processes. The following lists are listed in comparison: The options are as follows: -A lists the process status including other users. -u Displays the User - Oriented Process situation. -x Display includes a process situation without Terminal control. -W Use a wide display mode to display the process situation. We can achieve the status of the current processes, such as PID, Running State, etc. via PS. 2. The use of the Killkill instruction is to send a signal to a certain process. Because most of them are used to kill the process's sigkill or sighup, it is called Kill. Kill's usage: kill [-signal] pid ... kill -l sign is a Singal number, from 0 to 31, where 9 is Sigkill, which is generally used to kill some signals that cannot be normal Terminate. The use of its signal can be referred to the instructions for Signal in SIGVEC (2). You can also look at the number of words that can replace the Signal number with Kill -L. See Man Kill for detailed situations of Kill. c. Notes on the string processing: 1. Echoecho is used to display a string on the terminal. □ Echo -n is the action that does not have a jump after it is displayed. 2. GREP / FGREPGREP is a filter, which can be filtered out of one or more files, or filter out a string from the standard input filter. FGREP can be placed in a single file that is filtered, and then uses FGREP to filter out rows that belong to this group string. The usage of GREP and FGREP is as follows: grep [-nv] match_pattern file1 file2 .... fgrep [-nv] -f pattern_file file1 file2 .... -n puts the row found in front of the line to list -v The string -f -F -F -F -F -Fe -F -F-File that does not contain match_pattern is stored in Pattern_File is stored on the string D. The instruction of the query status is: 1. Manman is the meaning of manual. The function of the online help is used for the ON-line Help. The use of the user is used in use when using the user. The MAN is as follows: Man [-m path] [[section] title] ..... MAN [-m Path] -k keyword ... -m path man needs the path required by the Manual Database. We can also replace the -m option with the way to set the environment variable MANPATH. Title This is the goal to query. Section represents the classification of Manual, usually 1 represents executable instructions, 2 represents system call, 3 represents standard functions, and so on.

Fragment like the man inquiry: See Alsoapropos (1), CAT (1V), Col (1V), EQN (1), LPR (1), More (1), NROFF (1), Refer (1), TBL ( 1), Troff (1), Vgrind (1), Vtroff (1), Whatis (1), Eqnchar (7), Man (7), Catman (8) We want to refer to EqNChar (7) information, then us Enter MAN 7 EqNchar to get our own secondary messages. -k keyword is used to list Title containing this keyword. MAN is a very important instruction on UNIX. We use the usage only one of this lecture only one of the more common usage and a simple description, and the truly detailed usage and instructions should be required to use Man to get. 2. The Whowho directive is used to query those people now online. 3. The W W command is used to query those people now, and they show their current work. 4. Kuku can be used to search for the User on the entire network, unlike WHO just for the Local Host query. And KU provides the user to establish a function of searching for a specific user list. You can build a file information-file to store your friend's information, and then build a file hosts-file to specify the machine name of the search. The ku's instruction format can be obtained from Ku -h. E. Network Directive: UNIX provides a connection to the network so you can do some special things on various machines, such as you can do graphics on the IRIS graphics workstation in the line, on the Sun on the SUN Reading News, even to the school's meter to find a classmate Talk. These work can utilize UNIX's network instructions to connect to each different machine on your position. In this way, even if you are in the bedroom, you can work easily oriented in the system, you don't have to bubble in cold ice. The instructions of these networks are as follows: 1. The meaning of Rlogin and RSH Rlogin is Remote Login, which is to go to another machine Login via a network. Rlogin's format is: rlogin host [-l username] option -l username is the option that you must enter when you are different from the username and local host on the remote machine, otherwise Rlogin will assume you Username over there. The same as Localhost, and then errors will occur when login is first login. RSH is to perform some instructions on the remote machine, and turn the result back the result back to Local Host. RSH's format is as follows: RSH host [-l username] [command] is like Rlogin's parameter -L username, RSH's -l username is also username specified by Remote Host. COMMAND is the instruction to be executed on the Remote Host. If there is no Command specified, RSH will execute rlogin, just in direct Rlogin. However, RSH will not ask you Password like a normal login program while executing, but if you don't set Trust Table, Remote Host will not accept your request. RSH is required to set a file on each machine that may be used as Remote Host, called .rhosts. Each line of this file is divided into two parts, the first is to allow Login's hostname, and the second part is to allow login's UserName.

For example, in ccsun7.csie.nctu.edu.TW Your user Username is YSjuang, and your home is below. Rhost has the following line: ccsun6.cc.nctu.edu.tw U8217529 is in ccsun6.cc.nctu. The User U8217529 on the edu.tw machine can perform the RSH program with the following methods:% RSH ccsun7.csie.nctu.edu.tw -l ysjuang cat Mbox will Ysjuang in ccsun7.csie.nctu.edu.tw MBOX The file content is displayed on local hostccsun6.cc.nctu.edu.tw. If .RHOST has such a line, the USER U8217529 on ccsun6.cc.nctu.edu.TW will be able to directly via the RSH or RLogin Login to ccsun7.csie.nctu.edu.tw without entering Password. Note: .rhost is a table that sets the people that can trust, so if the setting is improper, it will make the person who can take the opportunity to invade the system. If you read Man 5 rhosts, you will find that you can use to replace any hostname in the first column, and use to replace any username in the second column. For example, user likes to use " username" to replace the column long strings Hostname, but this will make the User running Unix, you can get your Trust to invade your system. . This is easily dangerous in system security. So this department wrote your .rhost file in the way in this way, if discovered to stop until the center of the staff will correct it. Similarly, if your second field is , such as "Hostname ", you are allowed to enter your account with "all" users allowed to enter the password, it is more Dangerous behavior. So please be careful. 2. TelnetTelnet is a User to connect to Remote Host via a network. The TELNET format is as follows: telnet [hostname | ip-address] [port] hostname is a name address in ccsun1 or ccsun1.cc.nctu.edu.tw, IP-address is a number consisting of four less than 255 numbers. IP Address, such as the IP-Address of CCSUN1 is 140.113.17.173, ccsun1.cc.nctu.edu.tw's IP-AddRess is 140.113.4.11. You can connect to CCSUN1 using Telnet CCSUN1 or Telnet 140.113.17.173. Port for some special programs to give the outside world, such as the MUD of the system, providing some port to the MUT of the MUT by these ports. See Telnet (1) for details. 3. The meaning of ftpftp is File Transfer Program, which is a very common application of online file transmission. The FTP format is as follows: ftp [hostname | ip-address] where HostName | IP-Address's meaning is the same as Telnet. After entering the FTP, if it is connected to the Remote Host, it will ask you UserName and password. If the input is correct, you can start file transfer.

There are many commands in FTP. For details, please refer to FTP (1), here only listed more common CD, LCD, MKDir, PUT, MPUT, GET, MGET, BINARY, ASCII, PROMPT, HELP and Quit Use way. ASCII sets the transmission mode to ASCII mode. Usually used to transfer text files. Binary sets the transmission mode to a binary mode, usually used to transfer the execution file, the compressed file, and the image form. CD Remote-Directory changes the work directory on the Remote Host. LCD [Directory] Changes the working directory of Local Host. LS [Remote-Directory] [local-file] lists the files on the Remote Host. Get Remote-file [local-file] achieves a distant file. MGET Remote-Files can use a general-purpose character to get multiple files at a time. Put local-file [remote-file] Sending the file of Local Host to Remote Host. MPUT LOCAL-FILES You can use a general-purpose character to put multiple files on Remote Host once. Help [Command] Online Auxiliary Directive. MKDir Directory-name creates a directory in Remote Host. PROMPT changes the conversation mode. If ON is in the MPUT and MGET, each time a file is transmitted. Quit / Bye leaving FTP. Using FTP, we can transfer the required information on different machines. Some special machines are stored more information to capture the users of all localities. The school is more famous FTP Server. There is Nctucca and the ftp.csie.nctu.edu.csie.nctu.edu.tw. These FTP Server have a User called Anonymous, and a general "foreign guest" can take this username to acquire public information of the Server. However, Anonymous is asking for the use of Anonymous to enter its email address. In the past, many Taiwan users did not enter their Email Address according to the requirements of the FTP Server in foreign countries, but only casually play some words. Strings, causing dissatisfaction with many internet users and managers, becomes very bad for Taiwan's users, so it is also a considerable thing to follow the rules of FTP Server. f. Directs for communication: 1. Write instruction is to provide users to transfer messages to another user, use mode: Write username [TTY] 2. Talk / YTALK / CYTALK / CTALKUNIX dedicated conversation program. The screen is separated from the area of ​​your area and the object of the object, and can also talk to the user of different machines. How to use: talk username [@HOST] [TTY] 3. MESG Select whether to accept the Messege of others, if the Messege No, the Messege of others will not be delivered to you, and he can't interfere with your work. How to use: MESG [-n | -y] 4. Mail / ELM Email program on the Internet, allows letters mail to others via this program. How to use: mail [username] mail -f mailboxfile If you have any letters, type mail to read your mail. ELM provides more convenient interfaces than Mil, and can do the online alias. You can enter ELM to use up and down Left and right to select the read letters and you can press H to get the online Help file.

How to use: ELM [usernmae] ELM -F MailboxFile G. Compiler: Compiler's use is to translate the program you wrote into an executable file. The programmatic language commonly used in the system is C, Pascal, Fortran, etc. You can write a C or PASCAL or FORTRAN's original program, and then use these Compiler to turn it into an executable file. You can use this method to make your own special instructions. 1. CC / GCC (C Compiler) / USR / BIN / CC / USR / local / bin / gcc syntax: cc [-o execfile] Source GCC [-o execfile] Source Execfile is the name of the executive file you want, If the executable that does not have the -o option, the executable will be made as a.out. Source is a C program that is ended with .c. See the description of CC (1). 2. PC (PASCAL Compiler) / USR / local / bin / pc syntax: PC [-o execfile] Source Execfile is the name of the execution file you want, if not add-to -O option, can be completed, A.out is made as a file name. Source is a Pascal program ended with .p. See / Net / Home5 / Lang / MAN Instructions for PC (1). 3. F77 (FORTRAN Compiler) / Net / Home5 / Lang / F77 Syntax: F77 [-o Execfile] Source Execfile is the name of the executive file you want, if not add-to -O option, the executable file will be A.out is made as a file name. Source is a Fortran program ending with .p. h. Instructions for the print: The following is the instructions used in the printing table, in the printing machine, LP1, LP2 (point matrix printing machine), LW, SP, PS, Compaq (Lei Printing Machine) for use. 1. LPR LPR is an instruction used to print a file to the listing machine. Usage: lpr -P [Printer] File1 File2 File3 .... or lpr -P [printer]

转载请注明原文地址:https://www.9cbs.com/read-107274.html

New Post(0)