Common linux commands

Source: Internet
Author: User

 

Common linux commands

Name:/etc/aliases
Permission: System Administrator
Usage: Use newaliases to update the database
Note:
Sendmail uses a file in/etc/aliases for user name conversion. When sendmail receives a message to xxx, it sends it to another user based on the content in the aliases file. This function can create a user that is only valid in the mail system. For example, mailing list will use this function, in mailinglist, we may create a mailinglist called redlinux@link.ece.uci.edu, but in fact there is no redlinux user. The actual content of the aliases file is to send all the messages sent to this user to the mailing list processing program for delivery.

/Etc/aliases is a text file. sendmail requires/etc/aliases. db in binary format. The function of newaliases is to convert/etc/aliases into a database that sendmail can understand. Example:
# Newaliases

The following command will do the same thing,
# Sendmail-bi

Related commands:
Mail, mailq, newaliases, sendmail

"Mail [Return]
Name: mail

Permission: All Users

Usage: mail [-iInv] [-s subject] [-c cc-addr] [-B bcc-addr] user1 [user 2...]

Note:
Mail is not only a command, but also an email program. But there should be very few people who use mail to read emails! For system administrators, mail is very useful because managers can use mail to write scripts and send memos to system users on a regular basis.

Parameters:
I ignore tty interrupt signals. (Interrupt)
I forced the interaction mode. (Interactive)
V prints a message, such as the location and status of the mail. (Verbose)
N does not read the mail. rc configuration file.
S mail title.
C cc email address.
B. bcc email address.

Example:

To send a letter to one or more email addresses, the user must enter the title and content of the letter because no other options are added. If user2 does not have a host location, it is sent to the user2 user on the email server.
Mail user1@email.address
Mail user1@email.address user2

Send mail.txt content to user2 and cc to user1. If you set this line of command to cronjob, You can regularly send the memorandum to the System user.

Mail-s title-c user1 user2 <mail.txt

Command: mesg
Permission: All Users

Usage: mesg [y | n]

Determines whether to allow others to send messages to their terminal interfaces.

Count

Y: Allows messages to be transmitted to the terminal interface.
N: do not allow messages to be transmitted to the terminal interface.
If this parameter is not set, the message is transmitted. Otherwise, the current status of the Terminal interface is determined.

Example:
Change the current message settings to not allow the message to be uploaded to the terminal interface:
Mesg n
Mesg-related Commands include talk, write, and wall.
Name:/etc/aliases
Permission: System Administrator
Usage: newaliases
Note:
Sendmail uses a file in/etc/aliases for user name conversion. When sendmail receives a message to xxx, it sends it to another user based on the content in the aliases file. This function can create a user that is only valid in the mail system. For example, mailing list will use this function, in mailinglist, we may create a mailinglist called redlinux@link.ece.uci.edu, but in fact there is no redlinux user. The actual content of the aliases file is to send all the messages sent to this user to the mailing list processing program for delivery.

/Etc/aliases is a text file. sendmail requires/etc/aliases. db in binary format. The function of newaliases is to convert/etc/aliases into a database that sendmail can understand.

Parameter: No parameter. Example:
# Newaliases

The following command will do the same thing,
# Sendmail-bi

Related commands:
Mail, mailq, newaliases, sendmail
Name: talk
Permission: All Users

Usage:

Talk person [ttyname]
Views with other users

Calculation:
Person: the user account that you want to talk to. If the user is on another machine, you can enter the person@machine.name
Ttyname: if the user has more than two tty connections at the same time, you can select a suitable tty to send messages.

Example. 1:

When talking to the user Rollaend on the current machine, the Rollaend has only one line:
Talk Rollaend

The next step is to wait for Rollaend to respond. If Rollaend accepts the response, Rollaend enters 'talk jzlil' to start the discussion. Press ctrl + c to end the discussion.

Example 2: Use pts/2 To Talk To Rollaend users on linuxfab. cx:
Talk Rollaend@linuxfab.cx pts/2


The next step is to wait for the Rollaend response, if Rollaend accept, then Rollaend input 'talk jzlee@jzlee.home 'to start the discussion, press ctrl + c

Note: If the text on the screen is abnormal, press ctrl + l to update the screen.

Name: wall
Permission: All Users

Usage:
Wall [message]
Instructions for use:
Wall will send the message to the online users who set the mesg to yes. When the terminal interface is used as the standard input, the EOF (usually Ctrl + D) must be added at the end of the message)

Example:

Send the message "hi" to each user:
Wall hi
Name: write
Permission: All Users

Usage:

Write user [ttyname]
Description: transmits messages to other users.

Calculation:

User: the user account for which the message is to be sent
Ttyname: if the user has more than two tty connections at the same time, you can select a suitable tty to send messages.

Example. 1:

Send a message to Rollaend. At this time, Rollaend has only one line:
Write Rollaend

Press ctrl + c

Example 2: Send a message to Rollaend. The Rollaend connections include pts/2 and pts/3:
Write Rollaend pts/2

Press ctrl + c

Note: If the recipient sets mesg n, the agent will not be able to pass it to the other party at this time.

Name: kill
Permission: All Users

Usage:

Kill [-s signal |-p] [-a] pid...
Kill-l [signal]
Note: kill sends a specific signal (signal) to the stroke id of pid according to the specific action of the signal. If not specified, the preset is to send the signal of the termination (TERM ).
Count

-S (signal): The available signals include HUP (1), KILL (9), and TERM (15), which respectively indicate focusing on running, cutting off, and ending; for detailed signals, kill-l can be used.
-P: The pid is printed and no signal is sent.
-L (signal): lists all available signal names
Example:

Cut the stroke (kill) with a pid of 323 ):
Kill-9 323

Re-run (restart) a stroke with a pid of 456 ):
Kill-HUP 456

Name: nice
Permission: All Users

Usage: nice [-n adjustment] [-adjustment] [-- adjustment = adjustment] [-- help] [-- version] [command] [arg...]

Note: The program is executed in the changed priority order. If no program is specified, the current priority order is printed, and the preset adjustment is 10, range:-20 (highest priority) to 19 (lowest priority)


Count

-N adjustment,-adjustment, -- adjustment = adjustment: Add adjustment to the original priority
-- Help: Display help messages
-- Version: displays version information.
Example:
Add 1 to the priority of ls and execute:
Nice-n 1 ls

Add 10 to the ls priority and execute:
Nice ls will add 10 to the ls priority and execute

Note: priority is the parameter used by the job system to determine CPU allocation. Linux uses the round-robin algorithm for CPU scheduling. The higher the priority, the more CPU time you may obtain.

Name: ps
Permission: All Users
Usage: ps [options] [-- help]
Views: displays the dynamics of the instantaneous process.
Parameters:
There are many ps parameters. Only a few common parameters are listed here and their meanings are briefly described.
-A: list all the itineraries.
-W display widening can display more information
-Au displays more detailed information
-Aux: Show All itineraries containing other users

Au (x) output format:

User pid % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
USER: trip owner
PID: pid
% CPU: CPU usage
% MEM: memory usage
VSZ: Virtual Memory Used
RSS: memory used
TTY: the secondary device number of the terminal (minor device number of tty)
STAT: the status of the trip:
D: Non-disruptive static operations (I/O operations through □□ B)
R: Execution in progress
S: static
T: Pause execution
Z: it does not exist but cannot be eliminated for the moment.
W: insufficient memory paging allocable
<: High-priority itinerary
N: low-priority itinerary
L: memory is allocated by PAGE and locked in the memory (instant system or memory a I/O)
START: START Time of the trip
TIME: execution TIME
COMMAND: The executed COMMAND.
Example:
Ps
PID TTY TIME CMD
2791 ttyp0 00:00:00 tcsh
3092 ttyp0 00:00:00 ps
% Ps-
PID TTY TIME CMD
1? 00:00:03 init
2? 00:00:00 kflushd
3? 00:00:00 kpiod
4? 00:00:00 kswapd
5? 00:00:00 mdrecoveryd
.......
% Ps-aux
User pid % CPU % MEM VSZ RSS TTY STAT START TIME COMMAND
Root 1 0.0 0.7 1096 472? S Sep10 0: 03 init [3]
Root 2 0.0 0.0 0 0? SW Sep10 0: 00 [kflushd]
Root 3 0.0 0.0 0 0? SW Sep10 0: 00 [kpiod]
Root 4 0.0 0.0 0 0? SW Sep10 0: 00 [kswapd]
........
Name: pstree
Permission: All Users
Usage:
Pstree [-a] [-c] [-h |-Hpid] [-l] [-n] [-p] [-u] [-G |-U] [pid | user]
Pstree-V
Note: All the itineraries are displayed in a tree chart, and the tree chart is displayed with a pid (if specified)

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.