Introduction to basic UNIX command sets

Source: Internet
Author: User
Tags command line

The UNIX command set is a very distinctive set of commands. It is designed to be used to fully control UNIX machines. This section will discuss part of the UNIX command set. This section focuses on UNIX commands that are frequently used for Transmission Control Protocol (TCP) and Internet Protocols (IP). Note that we are going to discuss only the most common commands in Unix, not the commands. Each of the following sections describes one of the commands for the command set. At the end of this chapter, you will also learn the commands that hackers often use to invade servers.

1. Match character

When it comes to commands, if the corresponding file for the command is not in the current directory, UNIX will require that you invoke this command using the path name. Most commands are not in your directory but somewhere else in the system. In addition, most UNIX systems allow you to use matching characters (wildcard) to access files or directories. (table 1) lists the common matching characters in Unix.

2. redirect Character

Most UNIX commands and programs accept input from the keyboard and send output to the screen. But for most commands, you can also redirect their input to a text file and redirect its output to another file. For example: Suppose there is a program called Encrypter. It is obtained from keyboard input and is encrypted, and finally displayed on the screen. You can change its input again. For example, from a predefined file, you can use the character "" "for input redirection.

In Unix, you can execute the program by typing its name. If you want to redirect the input to a file, you can also place the file name to be redirected after the redirection character. For example: If the file is called: Top_secret, you should type the following command: Encrypter < Top_secret, the program will input from the file Top_secret and encrypt the last output to the screen.

On the other hand, you might want to have encrypter encrypt the files and store them separately. You can then redirect the input to another file. To do this, you can use the output redirection character, ">," If you want to save a private file, type it as follows: Encrypter < Top_secret > Private.

The Encrypter encryption program reads its contents from the file Top_secret and encrypts it, and then prints the results to the file private. The program will not write anything on the screen.

When using a redirected character, the shell creates the redirected output if the character does not exist. If the file already exists, the shell overwrites the file and replaces it with the encrypted content.

If you do not want to overwrite the contents of the file, you can use the redirection of UNIX to append the characters "> >". It appends the encrypted result to the end of the existing private file: Encrypter < top_secret> >private.

Of course, if private does not exist, the shell will create it.

3. Mastering Command line Options

Most UNIX commands have multiple options or switches that you can use to define different forms of the command. You can add these options after a command at the command line, typically using a broken polyline. For example, suppose the Encrypter program has an option called X, which can give encrypter a different encryption algorithm. So we can do a simple configuration of the encrypter, using Encrypter-x. If a command has more than one option, it can be added sequentially into the input stream. For example: Encrypter has two command options: X and Y. You can type the command Encrypter _xy as follows, if you define it in your program. But generally separate it, that is, type as follows: Encrypter _x _y.

4. Channel Character Introduction

Often, you want to use a channel to transfer the output of a command or program to another input. In Unix, you can use the pipe character "|" To complete the two-program connection. For example, if you use a command called a call to format the document in the format. If you have a file myreport that you want to browse in the reports format, you can do the following:

Cat Myreport | The

This command will send the Myreport file to the display command instead of directly on the screen. The Reporte command then continues processing and eventually appears on the screen in the format of the show.

5. Master Background Processing

You may choose to execute only one command and program in the background. That means you can let she11 execute it, but at the same time you can do a lot of other things. A command that executes in the background is typed just like a normal command, except that you need to add the "&" character behind it. For example, if you want to delete files in all directories in the background, type the following:

$RM * &

After you execute the command, you can still run another task, and when you perform the task in the background, a number appears and then returns you to the command prompt. The system-generated number is the process identifier for the command. The process identifier is important because you can use it to view the process table to determine if the command is still running. It will be discussed later.

Note: When you do background processing, the command or program can still get input from the keyboard and will be sent to the screen. If you do not want to interfere with your work while a command or program is in the background, you can use redirection.

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.