Common Linux commands

Source: Internet
Author: User
Tags decompress file touch command dmesg

Common Linux commands

Thank you very much, Mr. Yan, for teaching us a lot about linux! This blog is also designed to thank him!

Due to limited memory, the commonly used Linux commands can be sorted out for reference at any time:

Linux basic commands

Ls (list displays files and directories in the current directory. ls-l detailed display = ll)

[Root @ linux ~] # Ls [-aAdfFhilRS] Directory Name
[Root @ linux ~] # Ls [-- color = {none, auto, always}] Directory Name
[Root @ linux ~] # Ls [-- full-time] Directory Name
Parameters:
-A: All files are listed together with hidden files (Files starting ~
-A: All files, together with hidden files, are listed together, but do not include the two directories "." and ~
-D: only list the directory itself, not the archive data in the directory.
-F: directly list the results without sorting them (ls is sorted by file name by default !)
-F: attaches a Data Structure Based on files, directories, and other information, for example:
*: Indicates the executable file;/: indicates the Directory; =: indicates the socket file; |: indicates the FIFO file;
-H: lists the file capacity in a readable manner (such as GB and KB;
-I: List inode locations, not archive attributes;
-L: Serial Output of long data, including the attributes of files and other data;
-N: List UID and GID, rather than the names of users and groups (UID and GID will be mentioned in account management !)
-R: reversely outputs the sorting result. For example, if the original file name is from small to large, the reverse file is from large to small;
-R: It is listed together with the sub-directory content;
-S: sort by file capacity!
-T: sort by Time
-- Color = never: do not display the color based on the file features;
-- Color = always: Display color
-- Color = auto: allows the system to determine whether to give color based on the settings.
-- Full-time: Output in full time mode (including year, month, day, hour, and minute)
-- Time = {atime, ctime}: Output access time or change permission attribute time (ctime)
Instead of the content change time (modification time)

Cat displays the file content from the first line

[Root @ linux ~] # Cat [-AEnTv]
Parameters:
-A: equivalent to the Integration parameter of-vET. It can list some special characters ~
-E: The ending line break character $ is displayed;
-N: print the travel number;
-T: Click the [tab] button to display it with ^ I;
-V: list special characters that cannot be seen

The tac is displayed from the last line. We can see that the tac is written by cat!
When nl is displayed, the line number is output!

[Root @ linux ~] # Nl [-bnw] Archives
Parameters:
-B: Specifies the row number in two ways:
-B a: indicates that the row number is also listed no matter whether it is empty or not;
-B t: if there are empty rows, do not list the row numbers for the empty rows;
-N: Used to list row numbers. There are three methods:
-N ln: the row number is displayed on the leftmost side of the screen;
-N rn: the row number is displayed on the rightmost side of the field without 0;
-N rz: the row number is displayed on the rightmost side of the field and 0 is added;
-W: The number of digits occupied by the row number field.

More page-by-page display of File Content
Space: Indicates turning a page down;
Enter: Indicates turning "One Line" down 』;
/String: searches for the "string" in the displayed content 』;
: F: The file name and the number of currently displayed rows are displayed immediately;
Q: The archive content is no longer displayed when you leave more immediately.

Less is similar to more, but it is better than more. He can flip the page forward!
Space key: Scroll down a page;
[Pagedown]: Scroll down a page;
[Pageup]: returns a page up;
/String: searches down for the "string" function;
? String: the "string" search function is enabled;
N: Repeat the previous search (and/or? Related !)
N: Repeat the previous search (and/or? Related !)
Q: Leave the less program;

Head only looks at the first few rows

[Root @ linux ~] # Head [-n number] Archives
Parameters:
-N: Followed by a number, which indicates the meaning of several rows.

Tail only looks at a few lines of tail-200f logfile2 (the last 200 lines of logs are displayed)
Od reads the file content in binary format!

[Root @ linux ~] # Od [-t TYPE] File
Parameters:
-T: can be followed by various types of output, such:
A: Use preset characters for output;
C: use ASCII characters for output
D [size]: Uses decimal to output data. Each integer occupies size bytes;
F [size]: floating is used to output data. Each number occupies size bytes;
O [size]: Uses octal to output data. Each integer occupies size bytes;
X [size]: uses the hexadecimal format (hexadecimal) to output data. Each integer occupies size bytes;


Chmod (chmod + R filename adds the file read and write permissions, + R readable, + W writable, + X executable
(Chmod 777 filename is another way to increase the read and write permissions of files,
7 => corresponding to 111 readable and executable in octal format)

Chown (chown-R haowen. Grant all files and directories in the current directory permissions to haowen
,-R includes subdirectories)
Chgrp-R mysql. (change the current folder to the mysql group, mysql is an existing group) change the group of the file or directory.

Umask file preset permissions:
Umask specifies the "permission to be removed for this default value !』

Chattr (set the file hiding attribute)
Lsattr)

Find (find./-name file1-print, find the file named file1 from the current directory)
Mkdir (mkdir dir1, new directory dir1)

Mkdir [-mp] Directory Name
Parameters:
-M: Set the File Permission! Set directly. You don't need to look at the face of the preset permission (umask ~
-P: helps you directly recursively create the desired directory!

[Root @ linux ~] # Rmdir [-p] Directory Name
Parameters:
-P: deleted together with the "empty" directory on the upper layer.

Pwd Print Working Directory (pwd, show current path) pwd-P shows the correct path instead of the link path

Cd (cd/usr/local/enter the directory/usr/local/, cd ../and return to the upper-level directory.
./Current directory ../parent directory-represents the previous working directory ~ Represents the home directory where [current user identity] is located ~ Account indicates the user's home directory.) If you only enter cd, it indicates "cd ~ 』

Mv (mv file1/home/haowen/, move the file to the/home/haowen/directory
, Equivalent to window cut)
(Mv file1 filenew1, change the file name to filenew1)

[Root @ linux ~] # Mv [-fiu] source destination
[Root @ linux ~] # Mv [options] source1 source2 soure3... directory
Parameters:
-F: force indicates force-directed movement without asking;
-I: If the target file (destination) already exists, you will be asked if it is overwritten!
-U: update is performed only when the target file already exists and the source file is updated)

Cp (cp file1/home/haowen/, copy the file to the/home/haowen/directory.
Cp-r dir1/home/haowen/
Cp file1./file2 copy the file and rename it)

[Root @ linux ~] # Cp [-adfilprsu] destination)
[Root @ linux ~] # Cp [options] source1 source2 soure3... directory
Parameters:
-A: equivalent to-pdr;
-D: if the source file is a link file, copy the link file property instead of the file itself;
-F: force. If there are repeated or other questions, the user is not asked, but the user is forced to copy;
-I: If the destination effect (destination) already exists, the system will first ask if it is a real action during overwriting!
-L: Create a hard link instead of copying the file;
-P: copy the file together with its attributes, instead of using the predefined attributes;
-R: recursive continuous replication for directory replication;
-S: copy it into a symbolic link, that is, a "shortcut" file;
-U: If destination is earlier than source, it will update destination!

Rm (rm file1, rm-r dir1, rm-rf dir2 delete files or directories, f does not prompt to enter y

[Root @ linux ~] # Rm [-fir] archives or directories
Parameters:
-F: force indicates force removal;
-I: interactive mode. Before deletion, the user is asked for actions.
-R: recursive deletion! It is most commonly used to delete directories.

Touch creates an empty archive and modifies the archive date to the current (mtime and atime)

[Root @ linux ~] # Touch [-acdmt] Archives
Parameters:
-A: only modify access time;
-C: only modify the time without creating an archive;
-D: Followed by a date, or -- date = "date or time"
-M: only modify mtime;
-T: Followed by a time in the format of [YYMMDDhhmm]

File: If you want to know the basic data of a file, such as an ASCII, data file, or binary file, and whether dynamic library is used or not, you can use the file command to review it!

Which (for "execution file") This command is used to search for the file name of the "execution file" according to the PATH specified by the environment variable "PATH ".

[Root @ linux ~] # Which [-a] command
Parameters:
-A: Lists All commands that can be found, not the first command name.

Whereis (find a specific file from the database)

[Root @ linux ~] # Whereis [-bmsu] file or directory name
Parameters:
-B: Only find binary files.
-M: only find the file under the manual path of the description file.
-S: only find the source file
-U: there is no description file!

Function Description: calculates the number of words.
Syntax: wc [-clw] [-- help] [-- version] [file name]
Note: The wc command can be used to calculate the number of bytes, number of words, or number of columns of a file. If no file name is specified, or the given file name is "-", the wc command reads data from the standard input device. If no parameter is specified, the wc command displays the number of columns, characters, and bytes.
Parameters:
-C only displays the number of bytes, that is, the number of characters;
-L only displays the number of columns;
-W indicates only the number of words;
-M: displays the same number of characters.
-- Help Online help;
-- Version: displays the version information of the software.


Locate lists the full file names of a file from the database.

Find./-name index. jsp find the file named index. jsp in the current directory

Grep (grep "mobile = 13712345678" logfile1, in logfile1
Search for "mobile = 13712345678 ")

Ping (ping 61.129.78.9, ping www.163.com, and test whether the network connection is normal)
Ifconfig (ifconfig, view the local IP address, subnet mask, etc)

Ps (ps aux view processes started in the system, ps aux | grep programe1,
Check if program 1 is running
Kill (kill-9 2325, kill the process whose process number is 2325,
Killall programe1, killing the programe1 process)
Reboot (restart the system)
Init 0 (shutdown, only root users have the right to operate)
Init 6 (restart the system, only the root user has the right to operate)

Gzip (gzip file1, compressed file file1)
Gunzip (gunzip file1.gz decompress file file1.gz)

Tar-zcvf (tar-zcvf dir1.tar.gz./dir1, all contents in the dir1 directory under the current directory
Package name: dir1.tar.gz)
Tar-zxvf (tar-zxvf dir1.tar.gz, uncompress the package)

Echo "hello! "> File1 (Add" hello "to file file1,
Create file1 if file1 does not exist

Vi file2 (new file file2 by vi compiler)
... Enter welcome ..
(Press I to enter the insert status, that is, the insert mode. Press Esc to exit the insert mode.
In non-insert mode, press dd to delete the current row of the cursor, and press x to delete the current word,
Move the cursor by j, n, l)
: Wq (save and quit): q! (Exit without saving)

Add environment variable

[Root @ linux ~] # Echo $ PATH
[Root @ linux ~] # PATH = "$ PATH":/root

Env displays some environment variables of the system.
Set: displays all system variables.

Chmod:
Linux/Unix File call permissions are divided into three levels: file owner, group, and others.
Chmod can be used to control how files are called by others.
+ Adds a permission,-Indicates canceling the permission, and = indicates a unique permission.
R indicates readable, w indicates writable, and x indicates executable,

1. Set the file file1.txt to readable by all users:
Chmod ugo + r file1.txt or chmod 444 file1.txt

2. Set file file2 as the owner for read/write execution, Group, other, and only read
Chmod 744 file2 (7 => "111", 4 => "100" binary)

3. Set file file3 as the owner for read/write execution, Group, and other. If you have no permission, you cannot perform read/write operations)
Chmod 700 file3 (7 => "111", 0 => "000 ")

Each a, B, and c is a number, indicating the permissions of the User, Group, and Other respectively.
 
R = 4, w = 2, x = 1 if you want the rwx attribute, 4 + 2 + 1 = 7; if you want the rw-attribute, 4 + 2 = 6;
If you want the r-x attribute, 4 + 1 = 5
   
Tar:
Tar call gzip
Gzipis a program developed by gnuorganization. The file ending with .gz is the result of gzip compression.
The decompress program relative to gzip is gunzip. Use the-z parameter in tar to call gzip.
# Tar-czf all.tar.gz *. jpg

This command is to compress all .jpg files into a tar package and use gzip to generate
The package name is all.tar.gz.

# Tar-xzf all.tar.gz is used to unbind the generated package.
  
Date:

Instructions for displaying calendars with cal:

Bc easy to use calculator:

[Tab] button (press twice) command to complete:

[Ctrl]-c: press the key to interrupt the current program:

[Ctrl]-d (equivalent to entering exit:

Info online help:

Who should check who is online now:

Finger displays information about system users

Netstat-:

Ntsysv sets the service to start at the same time as the system starts

Shutdown and shutdown-h now are commonly used shutdown commands:

Reboot, halt, poweroff reboot, shutdown:

--- System-related commands :---
Dmesg: for example, dmesg | more: displays the diagnostic information, operating system version number, physical and other information of the system.
Df: for example, df-h shows hard disk space
Du: view the hard disk space used by subdirectories in the directory
Free: view the usage of system memory and virtual memory (swap space)
Top: dynamically and real-time viewing of system memory, CPU, and processes

Hostname:

Hostname new host name modification Host Name (temporary, restart will be gone ):

Man command: view the basic usage of this command
Info command: view the basic usage of this command
Ls-l/lib/modules/'uname-R'/kernel/fs
Cat/proc/filesystems view the file system currently enabled in Linux

Type query a command is from an external command (that is, the commands provided by other non-bash suites) or built-in commands in bash.

[Root @ linux ~] # Type [-tpa] name
Parameters:
: If no parameter is added, type Displays whether the name is an external command or a bash built-in command!
-T: when the-t parameter is added, type will show the meaning of name with the following words:
File: indicates an external command;
Alias: indicates the name set for the command alias;
Builtin: indicates that this command is a built-in command function of bash;
-P: If the followed name is a command, the complete file name (external command) or built-in command is displayed;
-A: All commands with names are listed in the PATH defined by the PATH variable, including alias

Set myname = pqb variable
PATH = "$ PATH": Add the/home/dmtsai/bin variable
View the echo $ myname variable
Unset myname variable Cancellation

Let's take a look at Shutdown. Shut down the system and use the Shutdown command to ensure that the user and system information is complete. Only root users can use this command.
Generally, this command cannot be executed.
Let's first look at the showdown Syntax:
Shutdown [options] when [message]
Options:-r indicates that the instance is restarted,-h indicates that the instance is shut down immediately after the system service is stopped (halt), and-f indicates that the instance is restarted quickly.
When: Specifies the shutdown time. Hh: mm: absolute time, hh refers to the hour, mm refers to the minute; for example, + m: m minutes later,
Now = + 0, that is, immediate execution
Message: indicates the broadcast information of the system. Generally, the system is prompted to shut down or restart each user. You must save the information and exit.
Let's take a look at several examples:
Shutdown-h now shut down immediately
Shutdown-h today shutdown
Shutdown-h + 10 minutes later shutdown
Shutdown-r now restart immediately
Shutdown-r + 10' the system will reboot 'restarts after 10 minutes. the Administrator prompts the user that the system is about to restart, so that the user can save
Information. Only root users can use this command.

Create a file
Creating a file is to create a common file and the file is empty.
Use the touch command to create a general file:
[Root @ Linux two] # touch 111.txt

Search for files
First, let's take a look at how to search for files. Especially when I first started learning Linux, I didn't know where to store my own files.
Raw. If you know the file name but do not know that the file is under that directory, you can use the locate command to search for the file. Follow these steps:
:
[Root @ Linux one] # locate install. log
/Root/install. log
/Root/install. log. syslog
Let's take a look. We searched for two files related to install. log. They are all in the/root directory. At the same time, we felt that using this command
This allows you to search for files quickly. To use this command, you must use it with the database, because this command is used to search for files from the database.
File. The database is updated every seven days. Follow these steps:
[Root @ Linux one] # touch 001.txt
[Root @ Linux one] # locate 001.txt
The new file cannot be found in this command. Therefore, before using this command to search for a file, you must update the database yourself (the root permission is required to update the database), as shown below:
Operation:
[Root @ Linux one] # updatedb
[Root @ Linux one] # locate 001.txt
/Root/one/001.txt
If you run the updatedb command to update the database, we can find the data we need. However, when updating the database
It takes a while.


Locale can view the language environment
The file that saves the language information is in/etc/sysconfig/i18n.

/Sbin/service xinetd restart | start | stop starts the background service,

/Sbin/chkconfig -- list | more: displays the startup status of system services, and displays the status from running level 0 to running level 6.
These services are started by the system script init. Some of the other services are not started by system scripts, but some special services are shown below. They are not
Started by init. Xinetd-enabled, an independent Internet server is a super service, and many sub-servers can be started.
Server.

We can see that as long as xinetd is enabled, it can run the servers under it. Most of the servers below it are closed, only
If you want to enable a service, you can use the chkconfig command. For example, if you want to enable rsync, you can
Run the chkconfig rsync on | off command.

Mount
When the mount command does not use any options or parameters, information about the mounted file system in the current linux system is displayed.

Mount Cttype dev dir
The disk file system type is: iso9660; dev indicates the name of the device to which the file system is mounted; the device name of the disc drive is/dev/cdrom; dir indicates the mount point, that is, the path of the mounted file directory.
The following describes how to attach a CD:
Mount-t iso9660/dev/cdrom/media/cdrom

List all storage devices in the system
Fdisk-l command

Use the "vfat" file system type to indicate all the fat file system types, including fat16 and fat32, ntfs or ntfs.
USB flash disk mounting method
Mount-t vfat/dev/sdb1/mnt/
Mount-t ntfs/dev/sdb1/mnt/

The umount command is used to detach a mounted file system. The basic format is umount dir device.

You can use any of the following two commands to detach a CD File System:
Umount/dev/cdrom
Umount/media/cdrom

Unmount USB flash drive
Umount/dev/sdb1

Eject command
Eject pop-up CD command
Eject-t disc drive auto recovery

Cut
Permission: All Users
Usage: cut-cnum1-num2 filename
Description: displays the text of each row starting from num1 to num2.
Example:
Shell> cat example
Test2
This is test1
Shell> cut-the first 6 characters starting with c0-6 example
Test2
This I

Command name: ln
Permission: All Users
Usage: ln [options] source dist, where the option format is:
[-BdfinsvF] [-S backup-suffix] [-V {numbered, existing, simple}]
[-- Help] [-- version] [--]

Note: there is a so-called link in the Linux/Unix File System. we can regard it as the alias of the file, and the link can be divided into two types: hard link) symbolic link indicates that a file can have multiple names, while a soft link generates a special file, the content of this file points to another file. Hard links exist in the same file system, but soft links can span different file systems.

Ln source dist is used to generate a connection (dist) to the source. As for hard link or soft link, it is determined by the parameter.

No matter whether it is a hard link or soft link, it will not copy the original file, it will only occupy a very small amount of disk space.

-F: delete the file with the same name as dist before link completion-d: Allow system administrators to hard link their directories-I: when deleting an archive with the same name as dist, first ask-n: During Soft link, dist will be treated as a general archive-s: perform soft link (symbolic link)-v: display file name B before link: Back up the file that will be overwritten or deleted at link end-S SUFFIX: add the backup file to the end of SUFFIX-v method: Specifies the backup METHOD -- help: displays the auxiliary instructions -- version: displays the version
Example:
Generate a symbolic link: zz
Ln-s yy zz
Generate a hard link: zz
Ln yy xx

Name:
Permission: All Users
Usage: at-V [-q queue] [-f file] [-mldbv] TIME
Note: at allows users to run a program or command at a specific TIME point. The TIME format is HH: MM, where HH is hour and MM is minute, you can even specify spoken words such as am, pm, midnight, noon, and teatime (four o'clock P.M. workshop.
If you want to specify a time later than one day, you can use the MMDDYY or MM/DD/YY format. MM indicates the minute, DD indicates the day, and YY indicates the year. In addition, users can even use now + time interval to elastically specify the time. The time interval can be minutes, hours, days, and weeks.
In addition, you can specify today or tomorrow to indicate today or tomorrow. After you specify the time and press enter, at enters the conversation mode and requires you to enter the command or program. After you enter the time, press ctrl + D to complete all the actions, the execution result will be sent back to your account.
Calculation:
-V: indicates the version number.
-Q: The specified Queue is used for storage. at data is stored in the so-called queue. You can use multiple queues at the same time, while queue is numbered, b, c... z and A, B ,... z: 52 in total
-M: Send a mail to the user even if no result is output after the program/command is executed.
-F file: Read the pre-written command file. The user does not have to use the conversation mode for input. You can first write all specified files to the file and then read them again.
-L: list all the specified values (users can also use atq directly instead of at-l)
-D: Delete the specified value (you can also directly use atrm instead of at-d)
-V: lists all completed but not deleted items.
Example:
Run the/bin/ls statement at five o'clock P.M. after three days:
At 5 pm + 3 days/bin/ls

Run the/bin/ls statement at five o'clock P.M. after three weeks:
At 5 pm + 2 weeks/bin/ls

Run/bin/date at tomorrow:
At 17:20 tomorrow/bin/date
The end of world is printed at the last minute of the last day of March!
At 23:59 12/31/1999 echo the end of world!

Name: cal
Permission: All Users
Usage: cal [-mjy] [month [year]
Note:
Display calendar. If there is only one parameter, the year (1-9999) is displayed. The year must be written in all format: ''cal 89 \ will not display the year 1989 region. Two parameters are used to indicate the month and year. If no parameter exists, the calendar of this month is displayed.
From January 1, 3rd, we switched to the new Western calendar. Because most countries use the new calendar, the calendar of this month is removed for 10 days. Therefore, the calendar of this month is somewhat different. Before that, it was an old Western calendar.
Kuang Dou:
-M: displayed on Monday as the first day of each week.
-J: displayed in the calendar of Caesar, that is, the number of days from January 1, January 1.
-Y: This year's quota is displayed.
Example:
Cal: displays the calendar of this month.
[Root @ mylinux/root] # date
Tue Aug 15 08:00:18 CST 2000
[Root @ mylinux/root] # cal
...

Cal 2001: 2001 AD Tib.
[Root @ mylinux/root] # cal 2001
...

Cal 5 2001: displays the calendar month of May 2001 AD.
[Root @ mylinux/root] # cal 5 5 2001


Name: crontab
Permission: All Users
Usage:
Crontab [-u user] filecrontab [-u user] {-l |-r |-e}
Note:
Crontab is used to allow users to run programs at a fixed time or interval. In other words, it is similar to the user's time table. -U user is used to set the time table of the specified user. The premise is that you must have the permission (for example, root) to specify the time table of another user. If-u user is not used, the time table is set.
Parameters:

-E: Execute the text editor to set the time table. The preset text editor is VI. If you want to use another text editor, set the VISUAL environment variable to specify the Text Editor (for example, setenv VISUAL joe)
-R: Delete the current time table.
-L: list the current time table

The time table format is as follows:
F1 f2 f3 f4 f5 program

F1 indicates the minute, f2 indicates the hour, f3 indicates the day of the month, f4 indicates the month, and f5 indicates the day of the week. Program indicates the program to be executed.
When f1 is *, the program is executed every minute, when f2 is *, the program is executed every hour, and so on.
When f1 is a-B, it indicates that execution is performed from the minute a to the minute B. When f2 is a-B, it indicates that execution is performed from the hour a to the hour B, other analogy
When f1 is */n, the execution is performed every n minutes. If f2 is */n, the execution is performed every n hours.
When f1 is a, B, c ,... a, B, c ,... execute in minutes. f2 is a, B, c ,... a, B, c... execute in hours, and so on
You can also store all settings in the file first, and use crontab file to set the time table.
Example:
Run the command/bin/ls once every 0th minutes of every hour every month:
0 7 ***/bin/ls

During October 11, December, execute/usr/bin/backup every 20 minutes from to every day:
0 6-12/3*12 */usr/bin/backup

From Monday to Friday, send a letter to alex@domain.name at pm:
0 17 ** 1-5 mail-s "hi" alex@domain.name </tmp/maildata

Execute echo "haha" at midnight, 00:20, and 02:20 every month"
20 0-23/2 *** echo "haha"

Note:
After the program is executed at the specified time, the system will send you a letter showing the program execution content. If you do not want to receive such a letter, add>/dev/null 2> & 1 after each row is null.


Name: sleep
Permission: All Users
Usage: sleep [-- help] [-- version] number [smhd]
Note: sleep can be used to delay the current action for a period of time.
Parameter description:
-- Help: displays auxiliary messages.
-- Version: displays the version number.
Number: the length of time. It can be followed by s, m, h, or d.
S indicates the second, m indicates the minute, h indicates the hour, and d indicates the number of days.
Example:
Display the current time after 1 minute delay, and then display the time again:
Date; sleep 1 m; date


Name: finger
Permission: All Users
Usage: finger [options] user [@ address]
Note: finger allows users to query information of other users.
Example: run the following command to query the information of the local administrator:
Finger root

Name: last
Permission: All Users
Usage: shell> last [options]
Description: displays the information of the First Login person in each month after the system is started.
Calculation:
-R omitting the field of hostname
-Num: displays the first num.
Username: displays the login information of username
Tty restricted login messages include terminal codes
Example:

Shell> last-R-2

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: expr
Permission: All Users
### String Length
Shell> expr length "this is a test"
14

### Digital business count
Shell> expr 14% 9
5

### Capture strings from locations
Shell> expr substr "this is a test" 3 5
Is

### Number string only the first character

Shell> expr index "testforthegame" e
2

### True string Reproduction
Shell> expr quote thisisatestformela
Thisisatestformela

Command: clear
Purpose: Clear the screen.
Usage: enter clear on the console.

Related Article

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.