Linux beginners must learn the command system (1)

1. Linux common system work commands

1. echo command

Function description:
The echo command is used to print the value of the shell variable in the shell, or directly output the specified string. The function of the echo command is to display a piece of text on the display, which generally acts as a prompt.
Application example:
use the echo command to print the text
echo -e "This is a book"
This is a book
Note: -e: activate escape characters.
When the -e option is used, if the following characters appear in the string, they will be treated specially instead of being output as normal text:

  • \a emits a warning sound;
  • \b delete the previous character;
  • \c does not add a newline at the end;
  • \f wraps the line but the cursor remains at the original position;
  • \n line feed and cursor moves to the beginning of the line;
  • \r Moves the cursor to the beginning of the line, but does not wrap;
  • \t insert tab;
  • \v is the same as \f;
  • \ insert \ character;
  • \nnn inserts the ASCII character represented by nnn (octal);

2. date command

Description:
The date command displays or sets the system time and date.
Application example:
1. Display the current time
date +"%Y-%m-%d"
2. Display the date of yesterday's time
-d "1 day ago" +"%Y-%m-%d"
Note: -d< character String>: Displays the date and time that the string refers to. Strings must be enclosed in double quotes;

3. reboot command

Description:
The reboot command is used to restart the running Linux operating system.
Application example:
reboot //Reboot.
reboot -w //Make a reboot simulation (only the record does not really reboot).
Other commands and usages that can be followed by reboot are as follows:
-d: Do not write data to the log file /var/tmp/wtmp when rebooting. This parameter has the effect of the "-n" parameter;
-f: Force restart without calling the function of the shutdown command;
-i: Close all network interfaces before restarting;
-n: Do not check whether there is any unfinished operation before restarting program of;

4. poweroff command

Function description:
The poweroff command is used to shut down the computer operating system and cut off the system power.
Application example:
use poweroff to shut down the system immediately: other commands and usages that can be followed by
poweroff poweroff are as follows: -n: do not perform sync operation when shutting down the operating system; -w: do not actually shut down the operating system, only in the log file "/var/ log/wtmp"; -d: do not write operations into the log file "/var/log/wtmp" when shutting down the operating system; add corresponding records; -f: forcibly shut down the operating system; -i: before shutting down the operating system Shut down all network interfaces; -h: Set all hardware in the system to standby mode before shutting down the operating system.






5. wget command

Usage instructions:
The wget command is used to download files from the specified URL.
Application example:
use wget to download a single file
wget http://www.csdn.net/testfile.zip
Other commands and usages that can be followed by wget are as follows:
-a <log file>: record the execution of data in the specified log file Process;
-A<suffix name>: Specify the suffix name of the file to be downloaded, and use commas to separate multiple suffix names;
-b: Run wget in the background;
-B<connection address>: Set the reference connection address -c
: continue to execute the last task of the terminal;
-C<flag>: set the server data block function flag on to activate, off to close, the default value is on;
-d: run command in debug mode;
-D <domain name list>: set the list of domain names to follow, separated by ",";
-e<command>: execute the specified command as part of the file ".wgetrc";
-h: display command help information;
- i<file>: get the URL address to be downloaded from the specified file;
-l<directory list>: set the directory list to follow, multiple directories are separated by ",";
-L: only follow the associated connection;
-r : Recursive download mode;
-nc: When the file exists, the downloaded file does not overwrite the original file;
-nv: Only update and error information is displayed when downloading, but the detailed execution process of the command is
not displayed; -q: The command execution process is not displayed;
- nh: do not query the host name;
-v: Display the detailed execution process;
-V: Display the version information;
–passive-ftp: Use the passive mode PASV to connect to the FTP server;
–follow-ftp: Download the FTP connection file from the HTML file.

6. ps command

Usage notes:
The ps command is used to report the process status of the current system.
Application example:
display all processes
ps -A
ps can be followed by other commands and usage as follows:
-a: Display all programs executed under the terminal, except for the stage job leader.
a: Display all programs under the current terminal, including programs of other users.
-c: Display the CLS and PRI fields.
c: When listing programs, display the real command name of each program, without the path, option or resident service designation.
-C<command name>: Specifies the name of the execution command and lists the status of the program that executes the command.
-d: Display all programs, excluding those of the stage job leader.
-e: This option has the same effect as specifying the "A" option.
e: When listing programs, display the environment variables used by each program.
-f: Display UID, PPIP, C and STIME fields.
f: Display the tree structure with ASCII characters to express the relationship between programs.
-g <group name>: The effect of this option is the same as specifying the "-G" option, and it can also be specified using the name of the stage job leader.
g: Display all programs under the current terminal, including the program of the group leader.
-G<group ID>: List the status of the programs belonging to the group, and can also use the group name to specify.
Note: Since there are so many other system commands that the ps command can support, I will not list them one by one here. Those who are interested can check them out by themselves.

7. top command

Usage instructions:
The top command can dynamically view the overall running status of the system in real time. It is a practical tool that integrates multi-party information to monitor system performance and running information. The interactive interface provided by the top command can be managed with hotkeys.
Application example:
display the complete command
top -c
top and other commands that can be followed and usage are as follows:
-b: operate in batch mode;
-d: screen refresh interval;
-I: ignore the failure process;
-s: keep secret mode;
-S: cumulative mode;
-i<time>: set interval time;
-u<user name>: specify user name;
-p<process number>: specify process
;

8. pidof command

Usage instructions:
The pidof command is used to find the process ID number of the process with the specified name.
Application example: find the id pidof
init process number of the process name pidof init 1 Other commands and usages that can be followed by pidof are as follows: -s: return only one process number; -c: only display processes with the same "root" directory; - x: Display the process started by the script; -o: Specify the process ID not to be displayed.






9. kill command

Instructions:
The kill command is used to delete a program or job in execution.
Application example:
List all signal names:
kill -1
insert image description here
Other commands and usages that can be followed by kill are as follows:
-a: When processing the current process, the correspondence between the command name and the process number is not limited;
-l <information number>: If Without the <information number> option, the -l parameter will list all the information names;
-p: specify that the kill command only prints the process number of the relevant process without sending any signals;
-s <information name or number>: specify Information to be sent;
-u: Specifies the user.

10. killall command

Usage instructions:
The killall command uses the name of the process to kill a process. Use this command to kill a group of processes with the same name.
Application example:
kill all processes with the same name as
vi
killall Other commands and usages that can be followed by vi killall are as follows:
-e: match the long name exactly;
-l: ignore the difference in case;
-p: kill the process to which the process belongs Process group;
-i: kill the process interactively, need to confirm before killing the process;
-l: print a list of all known signals;
-q: if no process is killed. No information is output;
-r: Use regular expressions to match the name of the process to be killed;
-s: Replace the default signal "SIGTERM" with the specified process number;
-u: Kill the process of the specified user.

To be continued. . .

Blog statement: The content of the above blog is written by myself after searching and integrating on the Internet. It is suitable for some basic instruction knowledge necessary for Linux beginners. I will share it with you as a personal note. If you don’t like it, don’t spray it! ! !

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324156531&siteId=291194637