linux common commands (seven)

The system for the exchange of information related commands

  • echo
  • mesg
  • wall
  • write

echo: the text displayed on the display

Command syntax: echo [options] [string]

Options Option Meaning
-n After represents the output text does not wrap

Example: Text "hello linux" to add a new file / root / notes in

[root@localhost ~]# echo hello linux > /root/notes
[root@localhost ~]# cat /root/notes
hello linux

$ HOME variable value display

[root@localhost ~]# echo $HOME
/root

mesg: Allow or Deny write a message

Mesg user command to control whether other users in the system can be used to send messages to their talk command or write command. In the case with no options, mesg command displays the current host message permission set command syntax: mesg [option]

Options Option Meaning
Y Allow all hosts on the local network to send messages to their hosts
n Only allow users to send messages to the root own host

Examples: Displays the current message permission setting

[root@localhost ~]# mesg
is y

Only allow users to send messages to the root own host

[root@localhost ~]# mesg n
[root@localhost ~]# mesg
is n

wall: for all logged-in users to send messages

Command syntax: wall [message]

Example: issue "Shut down the computer after work" a message to all users

[root@localhost ~]# wall Shut down the computer after work
[root@localhost ~]# 
Broadcast message from [email protected] (pts/0) (Sat Jun 29 21:49:54 2019): Shut down the computer after work 

write: sending a message to the user

Command Syntax: write [user] [Terminal Name]

Examples: sending information to the root user on the terminal in tty2 terminal tty3

[root@localhost ~]# tty
/dev/pts/0
[root@localhost ~]# write root /dev/pts/2
hello i am /dev/pts/0 ^C[root@localhost ~]# 

Displayed on the terminal is tty2

[root@localhost ~]# 
Message from [email protected] on pts/0 at 22:02 ... hello i am /dev/pts/0 EOF 

Excerpt: "Linux practical tutorial" People's Post published Yue was released in edited

Guess you like

Origin www.cnblogs.com/mylive/p/11108845.html