Linux/unix basic Command (ii)

Source: Internet
Author: User
Tags aliases bz2 sorts

Basic Commands-2
Compression and archiving
Packaged:
Archive, similar to packing before travelling
Compression:
To reduce the amount of disk space used, backups can be made to save network bandwidth when transferred over the network.
Packaged compression software
Windows:winrar 360 compression Good 7zip WinZip
Linux: Compact format: GZ, Bz2,xz,zip,z
Compression algorithms are different, resulting in different compression ratios

Compression software gzip bzip2 XZ zip
Software that can be packaged and compressed: TAR * * * *

One, Zip:
Compressed files generally end in. zip, which can compress the directory
Compressed syntax: Zip filename.zip file1 file2 ...
Zip compressed file name to be compressed
Do not delete the original file after compression
Archive: both archived and compressed
[Email protected] acltest]# zip com.zip com.txt
Adding:com.txt (deflated 99%)
Decompression: Unzip
-D: Specify the compression path

Ii.. gzip
1) gzip/path/to/somefile
The original file is deleted by default
-D Decompression
-#: Specify the compression ratio, the smaller the compression ratio, the greater the speed
2) Gunzip/path/to/some_compress_file
3) Zcat Some_compress_file to view the compressed file of the text without pressure
Example: #cp/var/log/messages.
gzip messages
Default suffix name:. gz
When gzip is compressed, the original file disappears and a compressed file is generated
Decompression: Gunzip
Gzip compressed package, after decompression, the compressed package disappears, the extracted file appears.
Compression is actually a level: the 1~9 1 level is the lowest, the fastest, the lowest efficiency, 9 the highest level, the slowest, the most efficient.
The default level is 6.

Third, bzip2
By default, compression is complete,
The original file also disappears, and the compressed package must end with a. bz2.
Typically able to generate smaller files than using gzip compression (high compression)
1) bzip2/path/to/somefile
-D: Unzip
-#: Specify compression ratio
-K: Keep the original file
2) Bunzip2/path/to/somefile
3) Bzcat/path/to/some_compress_file No pressure view
Decompression: BUNZIP2

Four. XZ compression ratio is greater
1) Compress XZ somefile
2) Unzip
Unxz
or Xzdec
-D: Unzip
-K: Keep the original file
-C: Input to screen
3) Xzcat No pressure view
Small experiment: Compare the size of files after bzip2 compression and gzip compression

Format of the later common compression package
. zip. tar.gz. tar.bz2

Tar can be both packaged and compressed
Tar option package name package file or directory//remember: Be sure to pay attention to the syntax format, first the packaged name, and then the stuff to pack.
Tar: Archive tool,. Tar
Example: TAR-CF
-C: Create an archive file
-F File.tar: Archived files for operations
-X: Expand Archive
--xattrs: Preserves extended attribute information for files when archiving
-T: Do not expand the archive to directly see which files are archived
-C: Specify the path when extracting
-r: Append files to the package
-V: Show detailed procedures
-ZCF: Archive and invoke gzip compression
-ZXF: Call gzip to unzip and expand Archive,-Z option to omit
-jcf:bzip2
-JXF:
-jcf:xz
-JXF:
1) packaging compression at the same time
-Z: Compressed or uncompressed using gzip compression
-j: Indicates compression or decompression using BZIP2 compression
-C: Represents the creation of--create
-V: Show detailed procedures
-F: Specify file, typically followed by parking name
-ZCVF ZCVF. tar.gz
-JCVF JCVF. tar.bz2

Tar zcvf com.tar.gz com.txt

Com.txt

ll

Total 67968
-rw-r--r--1 root root 367957 Jul 09:24 com.tar.gz

Tar zcvf/tmp/acltest.tar.gz/acltest/

2) unpacking. tar.gz. tar.bz2
-ZXVF ZXVF
-JXVF JXVF
-C: Specify the decompression path

Tar zxvf com.tar.gz-c/usr/local/src/ls/usr/local/src/

Com.txt Vmware-tools-distrib
3) Other options
-T: Do not understand the contents of the Package view package

Tar-tf/tmp/acltest.tar.gz

acltest/
Acltest/f1
Acltest/com.txt
Acltest/f3
Acltest/f2
Acltest/com.zip
Acltest/com.tar.gz
-r: Append files to the package
TAR-RF file appended with package name

Three. File Search
Which: the absolute path used to find the command
--Show the absolute path of the shell command
--Simply search for the command you want to find in the PATH variable
--Search for aliases, then find them from path
1. View the user's path variable: The search path for the command

Echo $PATH/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin

Command not found possible causes:
1) The Wrong knock
2) command not installed
3) The path of the command is not in the definition of the PATH variable

Cp which vim/tmp/vim2vim2/etc/passwd

Bash:vim2:command not found

/TMP/VIM2/ETC/PASSWD//absolute path execution

2. Add paths to Path
1) temporarily modify the path value

Path= $PATH:/tmp//$PATH: Retain variable original value echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/tmp
2) permanently modify the path value will always be used in the work
/etc/profile//Global profile, effective for all users
~username/.bash_profile//local profile, only valid for specific users

Vim/root/.bash_profile

Path= $PATH: $HOME/bin:/tmp//Add red Section
The above file is not immediately valid, and normally it is executed when the user logs on.

Source/root/.bash_profile//re-read the configuration file so that the changes take effect echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/root/bin:/tmp
Cons: Every time a new terminal or tag is opened, it needs to execute # source/root/.bash_profile
If you want to once and for all, then need to exit the system, re-login, that is, logout.
system--> Log out root--> log out

Echo $PATH/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/root/bin:/tmp which LS

Alias ls= ' ls--color=auto '
/bin/ls

which vim

/usr/bin/vim

Alias for Command: Alias
1. See what aliases are present on the system (root and normal user aliases may be different)

Alias

2. Set the alias of the command
1) Temporary

Alias vi= ' vim ' vi/etc/passwd//execute VI when actually performing VIM

2) Permanent, change file
Where is the alias defined?
(1)/ROOT/.BASHRC CP RM MV
(2)/ETC/PROFILE.D
colorls.sh
which2.sh
3. Cancel Aliases
[profile.d]# Unalias VI
[profile.d]# vi/etc/passwd//No color anymore
Locate
--Retrieve files by file name with the fastest retrieval speed
--all the things that can be retrieved are stored in the database.
-Locate limitations, some file systems, some files and some directories are not searched by default

1, suppose I know the name of the NIC configuration file, but do not know the specific path:

Locate Ifcfg-eth0

/etc/sysconfig/network-scripts/ifcfg-eth0

Locate Ifcfg

/etc/dbus-1/system.d/nm-ifcfg-rh.conf
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-lo
/sbin/ifcfg
/usr/lib64/networkmanager/libnm-settings-plugin-ifcfg-rh.so
/usr/share/man/man8/ifcfg.8.gz
/var/log/anaconda.ifcfg.log

2. Manually update the database

Cp which vim/root/vim3locate VIM3//No results found

Cause: Because the locate database is a one-day update, it is not updated in real time.

Updatedblocate vim3/root/vim3
Database file:/var/lib/mlocate/mlocate.db

Error:
1) database file does not exist
2) manually generate it

UpdateDB

3. Locate database configuration file

Vim/etc/updatedb.confls/tmp/vim2

/tmp/vim2

Locate VIM2//cannot be searched because/tmp is in the exclusion list

Find * * * *
--Global search file
--How to work: Search down the hierarchy of files, find eligible, print, or perform the appropriate actions

First, the syntax format
Find to search for path conditions (options) [Action]
1. Basic examples

find/etc/-name Network

/etc/vmware-tools/scripts/vmware/network
/etc/sysconfig/network
/etc/rc.d/init.d/network
In general, the larger the lookup range, the deeper the directory level, and the slower the lookup.

Mkdir-p/q/w/e/r/t/y/u/i/o/p/a/s/d/f/g/h/j/k/l/z/x/c/v/b/n/mtouch/q/w/e/r/t/y/u/i/o/p/a/s/d/f/g/h/j/k/l/z/x/c/v /b/n/m/test.txttime Find/-name test.txt

/q/w/e/r/t/y/u/i/o/p/a/s/d/f/g/h/j/k/l/z/x/c/v/b/n/m/test.txt
/acl/test.txt
/tmp/test.txt
Real 0m3.188s
User 0m0.061s
SYS 0m2.953s

2. Search by condition
1) Search by file name
-name: Search by name * * * *
-iname: Ignoring case

Find/etc-name Networkmanagerfind/etc-iname NetworkManager

/etc/rc.d/init.d/networkmanager
/etc/networkmanager
Wildcard: * represents any character
? Represents a single character
Find all files ending with. conf in the/etc directory

find/etc/-name *.conf

Find the/etc/directory, ending with. conf, with a name of 5 characters
find/etc/-name "?????. Conf

2) Find-type by file type
F: Normal file
b c D l s P

Find/var-type L//Find the var directory under type is soft-linked file ll find /var -type lVerify that all found are soft links find/tmp/-type F -type followed by only one letter 3) Search by Time
-atime N in days
-ctime N
-mtime N
-amin N in minutes
-cmin N
-mmin N
N is a number and can be preceded by + or--mtime n
+n:n+1 days ago
N # to N+1 days
Within-n:n days
Take n equals 7 for example:
Search for all files that have been visited in the last seven days
Find. -type f-atime-7
Search all files that were visited exactly seven days ago
Find. -type F-atime 7
Search for all files that have been accessed for more than seven days
Find. -type F-atime +7
Search for all files with access time exceeding 10 minutes
Find. -type F-amin +10
Find all files that are longer than the File.log modification time
Find. -type F-newer File.log

Episode:
View property information for a file? Stat file name

Stat passwd

File: ' passwd '
size:1030 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:917613 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
access:2015-08-08 20:38:22.080984537 +0800
modify:2015-08-08 20:38:22.080984537 +0800
change:2015-08-08 20:38:22.080984537 +0800
A file has three time:
Atime: Access time, cat more less ...
Mtime: The content of the file changes in time vim ... (also the time shown by LL)
CTime: The time when the properties of a file change, such as: Change of permissions, size change, owner, owning group, etc.
Example:

echo Hello > Filestat file

File: ' File '
Size:6 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:917619 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
ACCESS:2015-08-13 12:16:19.494018488 +0800
MODIFY:2015-08-13 12:16:19.495018470 +0800
CHANGE:2015-08-13 12:16:19.495018470 +0800

Cat file

Hello

Stat file

File: ' File '
Size:6 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:917619 links:1
Access: (0644/-rw-r--r--) Uid: (0/root) Gid: (0/root)
ACCESS:2015-08-13 12:17:32.381018468 +0800
MODIFY:2015-08-13 12:16:19.495018470 +0800
CHANGE:2015-08-13 12:16:19.495018470 +0800

chmod +x filestat File

File: ' File '
Size:6 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:1197781 links:1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
ACCESS:2015-08-13 12:17:32.381018468 +0800
MODIFY:2015-08-13 12:16:19.495018470 +0800
CHANGE:2015-08-13 12:21:55.563018148 +0800//ctime changes

echo hahaha >> filestat file

File: ' File '
Size:13 blocks:8 IO block:4096 Regular file
device:802h/2050d inode:1197781 links:1
Access: (0755/-rwxr-xr-x) Uid: (0/root) Gid: (0/root)
ACCESS:2015-08-13 12:17:32.381018468 +0800
MODIFY:2015-08-13 12:23:54.286017831 +0800
CHANGE:2015-08-13 12:23:54.286017831 +0800

1. Digital permission to print files

Stat-c%a File

755
2, print the letter of the file permissions

Stat-c%A File

-rwxr-xr-x

Find small examples by time

Mkdir/finddate

Thu 14:22:43 CST 2015

cd/find/

[find]# touch-t 08131425.30 f0813//-t: Specifies the creation time of the file Mmddhhmm.ss
[find]# touch-t 08121425.50 f0812
[find]# touch-t 08111426.30 f0811
[find]# touch-t 08101426.30 f0810
[find]# ll f*
-rw-r--r--1 root root 0 14:26 f0810
-rw-r--r--1 root root 0 14:26 f0811
-rw-r--r--1 root root 0 14:25 f0812
-rw-r--r--1 root root 0 14:25 f0813
--Find files that have been modified within 24 hours (1 days) under/find
[find]# Find. -mtime-1
.
./f0813
--Find the normal file under/find modified 2 days ago
[find]# Find. -type F-mtime +1
./f0810
./f0811
4) Search by user and group
-user User Name
-group Group Name
-uid UID
-gid GID
-nouser: Orphan file without owner's file
-nogroup: No files belonging to group
--Find files in the system where the owner is QUOTA2
[home]# Find/-user quota2-type F
[home]# Find/-user quota2-type f 2>/dev/null
--Find orphan files in the system
[home]# Userdel Quota2
[home]# Find. -type F-nouser
./quota2/.bash_history
./QUOTA2/.BASHRC
./quota2/.bash_profile
./quota2/.bash_logout
[home]# LLfind . -type f -nouser
-RW-------1 502 quota2 10:16./quota2/.bash_history
-rw-r--r--1 502 quota2./quota2/.bash_logout
-rw-r--r--1 502 quota2 176./quota2/.bash_profile
-rw-r--r--1 502 quota2 124./QUOTA2/.BASHRC
--Find the system owner is not the root of ordinary files! or-not.
[home]# Find/! -user Root-type F
Either-or or-O
--Find files in the system where the owner is not root or the type is a socket
[home]# Find/! -user Root-o-type S
5) Follow the permissions to find-perm
+222 or (user writable or group writable or other person writable) there are 1 locations in the binary, as long as one of these bits is satisfied
-222 and (User writable and group writable and other people can write) 1 of the binary must have 1

Rm-f/find/*cd/find/

[Find]# Touch p{r,w,x}_{1,2,3}
[find]# chmod pr_1
[find]# chmod pr_2
[find]# chmod 444 pr_3
[find]# chmod pw_1
[find]# chmod pw_2
[find]# chmod 222 Pw_3
[find]# chmod px_1
[find]# chmod px_2
[find]# chmod 111 Px_3
[find]# LLfind ./ -perm +020 -type f
--w--w----1 root root 0 15:13./pw_2
--w--w--w-1 root root 0 15:13./pw_3
[find]# LLfind ./ -perm -020 -type f
--w--w----1 root root 0 15:13./pw_2
--w--w--w-1 root root 0 15:13./pw_3
When the permission bit is only one bit, + and-are the same.
[find]# LLfind ./ -perm -222 -type f
--w--w--w-1 root root 0 15:13./pw_3
[find]# LLfind ./ -perm +222 -type f
--w-------1 root root 0 15:13./pw_1
--w--w----1 root root 0 15:13./pw_2
--w--w--w-1 root root 0 15:13./pw_3
Think: Find files in your system that have SUID permissions
6) Find-size by file size

  • Greater than
  • Less than
    Direct number equals
    ' B ' for 512-byte blocks (the "the default if no suffix is used)//0.5kb
    ' C ' for bytes
    ' W ' for two-byte words
    ' K ' for kilobytes (units of 1024x768 bytes)
    ' M ' for megabytes (units of 1048576 bytes)
    ' G ' for gigabytes (units of 1073741824 bytes)
    [find]# rm-f/find/*
    [find]# DD If=/dev/zero of=f1m bs=1m count=1
    [find]# DD If=/dev/zero of=f2m bs=1m count=2
    [find]# DD If=/dev/zero of=f3m bs=1m count=3
    [find]# DD If=/dev/zero of=f4m bs=1m count=4
    [find]# Find. -type f-size-3m
    ./f2m
    ./f1m
    [find]# Find. -type f-size 3M
    ./f3m
    [find]# Find. -type f-size +3m
    ./f4m
    3. Action
    -exec action--perform the action directly after finding the result
    -ok action--prompt before performing an action, i.e. interaction required
    [find]# Find. -type f-size +3m-exec ls-l {} \;
    -rw-r--r--1 root root 4194304 15:51./f4m
    {}--used instead of found results
    \; --Indicates the end flag
    [find]# Find. -type f-size +3m-ok ls-l {} \;
    < LS .... /f4m >? Y
    -rw-r--r--1 root root 4194304 15:51./f4m
    [find]# Find. -type f-size +3m-ok ls-l {} \;
    < LS .... /f4m >? N
    Practice:
    1, find the/find directory, type is a normal file file to move it to the/test directory
    [find]# Find. -type f-exec mv {}/test \;
    [find]# ls/test/
    f1m f2m f3m f4m
    Or
    [find]# MVfind . -type f/test
    2, to find the/test directory type is a normal file files, to back up, backup files with the suffix named. bak
    [find]# Find/test-type f-exec cp {} {}.bak \;
    [find]# ls/test/
    f1m f1m.bak f2m f2m.bak f3m f3m.bak f4m F4m.bak
    3, delete the/test directory under the modified time within one day of ordinary files
    [find]# find/test/-type f-mtime-1-exec rm {} \;
    grep text filtering

I. GREP: The goal is to filter out what users are interested in * * *
Syntax: grep [options] mode or keyword file list

Simple example:
[Loring ~]# grep root/etc/passwd
Root:x:0:0:root:/root:/bin/bash
Operator:x:11:0:operator:/root:/sbin/nologin
1 、--color shows the match to the keyword
[Loring ~]# grep--color root/etc/passwd
Root:x:0:0:root:/root:/bin/bash
Operator:x:11:0:operator:/root:/sbin/nologin
2.-I ignores case
[Loring tmp]# grep--color-i root/find/passwd
Root:x:0:0:root:/root:/bin/bash
Operator:x:11:0:operator:/root:/sbin/nologin
3,-V take the reverse
Filter out rows that do not contain nologin
[Loring tmp]# Grep-v NOLOGIN/ETC/PASSWD

4. ^ Start with a keyword
Display non-commented lines in the/ROOT/.BASHRC file
[Loring tmp]# Grep-v ^#/ROOT/.BASHRC
5, $ with a keyword end
Display lines ending in sh in the passwd file
[Loring tmp]# grep sh$/etc/passwd
6, ^$ empty line
Show non-commented lines and non-blank lines in the/ROOT/.BASHRC file
[Loring tmp]# grep-v ^#/ROOT/.BASHRC | Grep-v ^$

7,-c count, count the number of rows to match
[Loring tmp]# Grep-c ROOT/ETC/PASSWD
2
8,-L general and-R are used to display only the name of the file containing the keyword, instead of displaying the contents of the file
9.-R Recursive retrieval
Displays the file name that contains the root in the contents of the test directory
[Loring tmp]# Grep-rl Root/test

10,-Q quiet Silent output is generally used when writing scripts
[Loring tmp]# Grep-q ROOT/ETC/PASSWD
[Loring tmp]# echo $? $? Represents the execution result of the previous command
0
The returned result is 0: indicates that the previous command was executed successfully
Return result not 0: Indicates that the previous command failed to execute
[Loring tmp]# Grep-q JSJDJJDFHFH/ETC/PASSWD
[Loring tmp]# echo $?
1
[Loring tmp]# Grep-q Root/asdaf
grep:/asdaf:no such file or directory
[Loring tmp]# echo $? File does not exist return 2
2

11,-n Displays the line number of the matching row
[Loring tmp]# Grep-n ROOT/ETC/PASSWD
1:root:x:0:0:root:/root:/bin/bash
11:operator:x:11:0:operator:/root:/sbin/nologin

-A
-B
-C

grep Exercises:
1. Display the line containing root in the/etc/group file
[Loring test]# grep Root/etc/group
2. Display lines in the/etc/passwd file that begin with the RP
[Loring test]# grep ^rp/etc/passwd
3. Display the line in the/etc/group file that does not end with:
[Loring test]# grep-v: $/etc/group
4. Display blank line in/etc/rc.local file, require line number
[Loring test]# Grep-n ^$/etc/rc.local
6:
5. Display only files of the file type directory in the/mnt/cdrom directory (provided that the disc is mounted and no find is used)
[Loring test]# ll/mnt/cdrom/| grep ^d

Two, cut: is the meaning of interception, its processing object is a "line" of text, you can select the part that the user needs, do not affect the original file
can specify a delimiter, and then print out a specific column separated by a delimiter or a few columns
syntax: CUT-F the specified column-d ' delimiter '
-D: Specifies the field delimiter
-F: Specifies the area to output, with multiple commas separating
-C: The character of the specified column
displays the user name and UID fields in the/etc/passwd file
[Loring test]# cut-d:-f1,3 /ETC/PASSWD
[Loring test]# head-5/etc/passwd | cut-d:-f1,3
root:0
bin:1
Daemon:2
adm:3
Lp:4
[ Loring test]# head-5/etc/passwd > T1
[Loring test]# vim T1
:%s/://g
[Loring test]# cat T1
Root x 0 0 Root/root/bin/bash
Bin x 1 1 bin/bin/sbin/nologin
Daemon x 2 2 daemon/sbin/sbin/nologin
ADM x 3 4 Adm/var /ADM/SBIN/NOLOGIN
LP x 4 7 Lp/var/spool/lpd/sbin/nologin
Take the first field
[Loring test]# cut-d ""-f1 T1
, separated by a space) OT
Bin
Daemon
ADM
LP
Remove the field from the group name in the/etc/group file
cut-d:-f1/etc/group
Print/etc/passwd characters for each line in the 第1-5个 file, and the contents of the 第7-10个 character
[[email protected] test]# cat/etc/passwd | cut-c 1-5,7-10

Third, sort sorts
-T: Specify field Delimiter
-K: Specify the first few fields
-N: Sort by numerical order
-R: Reverse Sort Reverse
-U: Repeat lines only print once unique
[email protected] test]# cat Sort.txt
B:3
C:2
A:4
E:5
D:1
F:11
Sort the output directly by default, sorted by the first character of each line
[email protected] test]# Cat Sort.txt | Sort
A:4
B:3
C:2
D:1
E:5
F:11
Reverse order of output content
[email protected] test]# Cat Sort.txt | Sort-r
F:11
E:5
D:1
C:2
B:3
A:4
Use ":" To do a delimiter to sort the 2nd field
[email protected] test]# Cat Sort.txt | Sort-t ":"-K 2
D:1
F:11
C:2
B:3
A:4
E:5
Use ":" To make a delimiter, sort the 2nd field, sort by number size
[email protected] test]# Cat Sort.txt | Sort-t ":"-K 2-n
D:1
C:2
B:3
A:4
E:5
F:11
Sort the/etc/passwd files by uid
[Loring test]# Sort-t ":"-K 3-n/etc/passwd

Sort the passwd files in the order of the UID from large to small
[Loring test]# Sort-t ":"-K 3-nr/etc/passwd

Print/etc/group in order of GID from small to large
[Loring test]# sort-t:-k3-n/etc/group

Four, uniq to heavy, the only
Remove adjacent duplicate rows
-C: Shows the number of duplicate rows
-I: Ignore case
[Loring test]# Uniq Num.txt
111
222
333
444
222
555
When using Uniq, the general first sorts, then the heavy
[Loring test]# Sort Num.txt | Uniq
111
222
333
444
555

[Loring test]# Sort Num.txt | Uniq-c
1 111
3 222
2 333
1 444
1 555

The main function of TR is to convert or delete text.
Convert lowercase letters in/etc/passwd files to uppercase
[Email protected] test]# CAT/ETC/PASSWD | TR ' [A-z] ' [A-z] '
Delete the ":" In the/etc/passwd file
[Email protected] test]# CAT/ETC/PASSWD | Tr-d ":"
Vi. paste text Merge. Merge the files into rows, using the tab-separated in the middle.
[email protected] test]# cat A.txt
1
2
3
4
5
[email protected] test]# cat B.txt
A
B
C
D
E
Merge files by row
[email protected] test]# paste A.txt b.txt
1 A
2 b
3 C
4 D
5 E
You can also use-D to specify the delimiter between rows of a merged file
[Email protected] test]# paste-d: A.txt b.txt
1:a
2:b
3:c
4:d
5:e
[Email protected] test]#

Linux/unix basic Command (ii)

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.