欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Linux基本命令

程序员文章站 2022-03-04 19:44:10
...
  • 切换用户
[aaa@qq.com ~]# su hadoop
[aaa@qq.com root]$ su root
Password:
[aaa@qq.com ~]#

  • 显示当前目录:pwd
  • 进入上次目录:cd -
  • 按列表形式查看目录:ls -l 等价于 ll
  • 查看别名:alias
  • 查看所有文件:ls -la/ls -al /ls -l -a(-l :以列表形式显示 -h:人性化 -a:显示.开头的文件)
  • 创建文件夹:mkdir
  • 创建文件夹:touch
  • 查看文件:cat echo:追加内容 一个>是覆盖,两个>>是追加
[aaa@qq.com a]$ echo helloworld >> test.txt
[aaa@qq.com a]$ ls
test.txt
[aaa@qq.com a]$ ls -l
total 4
-rw-rw-r--. 1 hadoop hadoop 22 Dec 15 01:53 test.txt
[aaa@qq.com a]$ cat test.txt
helloworld
helloworld
[aaa@qq.com a]$ echo nihao > test.txt
[aaa@qq.com a]$ cat test.txt
nihao
[aaa@qq.com a]$
  • 复制文件:
[aaa@qq.com a]$ ls
test.txt
[aaa@qq.com a]$ cp test.txt test.txt1
[aaa@qq.com a]$ ls
test.txt  test.txt1
[aaa@qq.com a]$ cat test.txt1
nihao
[aaa@qq.com a]$
[aaa@qq.com a]$ ls
1.txt  2.txt
[aaa@qq.com a]$ mkdir temp
[aaa@qq.com a]$ ls
1.txt  2.txt  temp
[aaa@qq.com a]$ cp *.txt temp/
[aaa@qq.com a]$ ls
1.txt  2.txt  temp
[aaa@qq.com a]$ cd temp
[aaa@qq.com temp]$ ls
1.txt  2.txt
[aaa@qq.com temp]$

  • 删除文件
[aaa@qq.com a]$ rm test.txt
[aaa@qq.com a]$ ls
test.txt1
[aaa@qq.com
  • 删除目录(强行递归删除)
[aaa@qq.com a]$ rm -rf temp
[aaa@qq.com a]$ ls
1.txt  2.txt
[aaa@qq.com a]$

  • 移动
[aaa@qq.com a]$ ls
[aaa@qq.com a]$ echo hello >1.txt
[aaa@qq.com a]$ ls
1.txt
[aaa@qq.com a]$ mkdir temp
[aaa@qq.com a]$ ls
1.txt  temp
[aaa@qq.com a]$ mv 1.txt temp
[aaa@qq.com a]$ ls
temp
[aaa@qq.com a]$ cd temp
[aaa@qq.com temp]$ ls
1.txt
[aaa@qq.com temp]$


  • 文本模式切换:ctrl+alt+f6
  • **鼠标:ctrl+alt
  • 切换到桌面模式:ctrl+alt+f1
  • 切换到新的文本模式:ctrl+alt+f5
  • nano文本编辑器   CTRL + o 保存文件  CTRL+x  退出 CTRL+k 剪切 CTRL+ u撤销(复制一行)
  • more:查看文件分屏显示
  • tail:查看文件后10行
  • find:查找所有文件
[aaa@qq.com ~]# find . > c.txt(重定向新建文件)
[aaa@qq.com ~]# more c.txt

Linux基本命令

[aaa@qq.com ~]# find . | more效果和上面一样,通过管道符,将前面的输出作为后面的输入,可以不停的叠加
  • man:查看详细的帮助信息
  • more指定显示的行数:
    [aaa@qq.com ~]# find . | more -3
    

  • head
[aaa@qq.com ~]# cat test.txt
1
2
3
4
5
6
7
8
9
10
11
12
[aaa@qq.com ~]# head test.txt
1
2
3
4
5
6
7
8
9
10
[aaa@qq.com ~]# head -5 test.txt//查看前5行
1
2
3
4
5
[aaa@qq.com ~]# head --lines=3 test.txt//查看前三行
1
2
3
[aaa@qq.com ~]# head --lines=-2 test.txt//除去后两行
1
2
3
4
5
6
7
8
9
10
[aaa@qq.com ~]#


[aaa@qq.com ~]# head -n 2 test.txt//查看前两行
1
2
[aaa@qq.com ~]#
[aaa@qq.com ~]# cat test.txt
1
2
3
4
5
6
7
8
9
10
11
12
[aaa@qq.com ~]# tail test.txt//查看后10行
3
4
5
6
7
8
9
10
11
12
[aaa@qq.com ~]# tail -3 test.txt//查看后3行
10
11
12
[aaa@qq.com ~]# tail --lines=5 test.txt//查看后5行
8
9
10
11
12
[aaa@qq.com ~]# head --lines=-4 test.txt//去掉后4行
1
2
3
4
5
6
7
8
  • 单词统计
[aaa@qq.com ~]# echo hello word > a.txt
[aaa@qq.com ~]# cat a.txt
hello word
[aaa@qq.com ~]# wc -c a.txt //字符
11 a.txt
[aaa@qq.com ~]# wc -l a.txt //行数
1 a.txt
[aaa@qq.com ~]# wc -w a.txt//单词数
2 a.txt
[aaa@qq.com ~]# wc -c -l -w a.txt//字符 行数 单词数
 1  2 11 a.txt
[aaa@qq.com ~]# wc -clw a.txt
 1  2 11 a.txt
[aaa@qq.com ~]# wa a.txt
bash: wa: command not found...
[aaa@qq.com ~]# wc a.txt
 1  2 11 a.txt
[aaa@qq.com ~]#

  • 查看主机名
[aaa@qq.com ~]# hostname
localhost.localdomain

  • 查看系统名称,内核,处理器,操作i系统
[aaa@qq.com ~]# uname -a
Linux localhost.localdomain 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
[aaa@qq.com ~]# uname -s
Linux
[aaa@qq.com ~]# uname -n
localhost.localdomain
[aaa@qq.com ~]# uname -r
3.10.0-327.el7.x86_64
[aaa@qq.com ~]# uname -v
#1 SMP Thu Nov 19 22:10:57 UTC 2015
[aaa@qq.com ~]# uname -m
x86_64
[aaa@qq.com ~]# uname -p
x86_64
[aaa@qq.com ~]# uname -i
x86_64
[aaa@qq.com ~]# uname -o
GNU/Linux
[aaa@qq.com ~]#

  • 查看文件类型  file  XXXX
  • 文件原地压缩
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 21 Dec 16 18:54 bb
[aaa@qq.com aa]# gzip a.txt//压缩文件
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root 32 Dec 16 18:52 a.txt.gz
drwxr-xr-x. 2 root root 21 Dec 16 18:54 bb
[aaa@qq.com aa]# gzip -d a.txt.gz//解压文件
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 21 Dec 16 18:54 bb
[aaa@qq.com aa]# gzip -r bb//递归压缩文件夹
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 21 Dec 16 18:54 bb
[aaa@qq.com aa]# gzip -dr bb//递归解压文件夹
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 18 Dec 16 18:56 bb
[aaa@qq.com aa]#

  • 原地解压文件
[aaa@qq.com aa]# gzip a.txt
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root 32 Dec 16 18:52 a.txt.gz
drwxr-xr-x. 2 root root 18 Dec 16 18:56 bb
[aaa@qq.com aa]# gunzip a.txt.gz
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 18 Dec 16 18:56 bb
[aaa@qq.com aa]# gzip -r bb
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 21 Dec 16 19:00 bb
[aaa@qq.com aa]# gunzip -r bb
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root  6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root 18 Dec 16 19:00 bb
[aaa@qq.com aa]#

  • 文件/文件夹归档
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    18 Dec 16 19:00 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:16 my.tar
[aaa@qq.com aa]# tar -cf my.tar a.txt//将文件a.txt归档在my.tar中
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    18 Dec 16 19:00 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:18 my.tar
[aaa@qq.com aa]# tar -xvf my.tar//抽取文件a.txt
a.txt
[aaa@qq.com aa]# rm a.txt
rm: remove regular file 鈥榓.txt鈥? y
[aaa@qq.com aa]# ll
total 12
drwxr-xr-x. 2 root root    18 Dec 16 19:00 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:18 my.tar
[aaa@qq.com aa]# tar -xvf my.tar
a.txt
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    18 Dec 16 19:00 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:18 my.tar
[aaa@qq.com aa]#

  • 文件夹归档
[aaa@qq.com aa]# tar -cf my.tar bb//归档文件夹bb
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    18 Dec 16 19:00 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]# rm -f bb
rm: cannot remove 鈥榖b鈥? Is a directory
[aaa@qq.com aa]# rm -r bb
rm: descend into directory 鈥榖b鈥? y
rm: remove regular file 鈥榖b/a.txt鈥? y
rm: remove directory 鈥榖b鈥? y
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]# tar -xvf my.tar//抽取文件夹bb
bb/
bb/a.txt
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    18 Dec 16 19:00 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]
  • xargs:多行变单行 按照空格符代替回车符号
[aaa@qq.com bb]# ll
total 0
[aaa@qq.com bb]# cd ..
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     0 Dec 16 19:44 1.jgp
-rw-r--r--. 1 root root     0 Dec 16 19:44 2.jsp
-rw-r--r--. 1 root root     0 Dec 16 19:44 3.txt
-rw-r--r--. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root     6 Dec 16 19:46 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]# find . |grep txt |cp `xargs` bb//查看aa文件夹下的所有文件 ,过滤出txt文件结尾的,拷贝到文件夹bb  ``反引号是强制命令解析
[aaa@qq.com aa]# cd bb
[aaa@qq.com bb]# ll
total 4
-rw-r--r--. 1 root root 0 Dec 16 19:47 3.txt
-rw-r--r--. 1 root root 6 Dec 16 19:47 a.txt
[aaa@qq.com bb]#

  • 命令的嵌套
[aaa@qq.com bb]# echo 192.168.109.1 > s.txt
[aaa@qq.com bb]# ll
total 8
-rw-r--r--. 1 root root  0 Dec 16 19:47 3.txt
-rw-r--r--. 1 root root  6 Dec 16 19:47 a.txt
-rw-r--r--. 1 root root 14 Dec 16 19:59 s.txt
[aaa@qq.com bb]# ping `cat s.txt`
PING 192.168.109.1 (192.168.109.1) 56(84) bytes of data.
64 bytes from 192.168.109.1: icmp_seq=1 ttl=128 time=0.557 ms
64 bytes from 192.168.109.1: icmp_seq=2 ttl=128 time=0.334 ms
64 bytes from 192.168.109.1: icmp_seq=3 ttl=128 time=11.0 ms
64 bytes from 192.168.109.1: icmp_seq=4 ttl=128 time=0.625 ms
^C
--- 192.168.109.1 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3125ms
rtt min/avg/max/mdev = 0.334/3.134/11.022/4.555 ms
[aaa@qq.com bb]#

  • 查看命令所在路径
[aaa@qq.com home]# which cat
/usr/bin/cat
[aaa@qq.com home]# which nano
/usr/bin/nano

  • 显示环境变量,区分大小写
[aaa@qq.com home]# echo $PATH
/root/.bashrc/anaconda3/bin:/usr/local/maven352/bin:/root/anaconda3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/spark2.2/bin:/usr/local/spark2.2/sbin:/usr/local/jdk1.8/bin:/root/bin
[aaa@qq.com home]#

  • bin/sbin:binary /super binary 二进制可执行文件 sbin用于存放重要性更高级的文件
  • 文件权限
chmod权限的修改只能owner或者root才能够修改  
r:文件:读取内容 //(read)
 文件夹:查看文件内容  
w:文件:编辑文件//write
 文件夹:增删文件
x:文件:运行程序//excute
 文件夹:进入该目录

修改linux文件权限命令:chmod

u:user 拥有者
g:group  组
o:other 其他用户
ugo=a=all  所有用户和组

r:4
w:2
x:1

chmod [who] [+ | - | =] [mode] 文件名¼

  命令中各选项的含义为:

  操作对象who可是下述字母中的任一个或者它们的组合:

  u 表示“用户(user)”,即文件或目录的所有者。

  g 表示“同组(group)用户”,即与文件属主有相同组ID的所有用户。

  o 表示“其他(others)用户”。

  a 表示“所有(all)用户”。它是系统默认值。

  操作符号可以是:

  + 添加某个权限。

  - 取消某个权限。

  = 赋予给定权限并取消其他所有权限(如果有的话)。

  设置mode所表示的权限可用下述字母的任意组合:

  r 可读。

  w 可写。

  x 可执行。

[aaa@qq.com ~]# mkdir aaa
[aaa@qq.com ~]# ls
aaa        anaconda-ks.cfg  Documents  Music     Public     test.txt
anaconda3  Desktop          Downloads  Pictures  Templates  Videos
[aaa@qq.com ~]# ll
total 12
drwxr-xr-x.  2 root root    6 Dec 15 05:17 aaa
drwxr-xr-x. 22 root root 4096 Nov 29 01:48 anaconda3
-rw-------.  1 root root 2741 Nov 23 20:24 anaconda-ks.cfg
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Desktop
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Documents
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Downloads
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Music
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Pictures
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Public
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Templates
-rw-r--r--.  1 root root   21 Dec 12 05:46 test.txt
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Videos
[aaa@qq.com ~]# chmod u-w aaa//user取出write权限
[aaa@qq.com ~]# ll
total 12
dr-xr-xr-x.  2 root root    6 Dec 15 05:17 aaa
drwxr-xr-x. 22 root root 4096 Nov 29 01:48 anaconda3
-rw-------.  1 root root 2741 Nov 23 20:24 anaconda-ks.cfg
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Desktop
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Documents
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Downloads
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Music
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Pictures
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Public
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Templates
-rw-r--r--.  1 root root   21 Dec 12 05:46 test.txt
drwxr-xr-x.  2 root root    6 Nov 29 00:47 Videos
[aaa@qq.com ~]#
[aaa@qq.com aa]# chmod ugo+rwx a.txt//给user/group/other添加read/write/execute权限
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     0 Dec 16 19:44 1.jgp
-rw-r--r--. 1 root root     0 Dec 16 19:44 2.jsp
-r--r--r--. 1 root root     0 Dec 16 19:44 3.txt
-rwxrwxrwx. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    42 Dec 16 19:59 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]#
[aaa@qq.com aa]# chmod 621 a.txt//通过数字修改权限
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     0 Dec 16 19:44 1.jgp
-rw-r--r--. 1 root root     0 Dec 16 19:44 2.jsp
-r--r--r--. 1 root root     0 Dec 16 19:44 3.txt
-rw--w---x. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    42 Dec 16 19:59 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]#


[aaa@qq.com aa]# chmod g=r a.txt //直接赋值
[aaa@qq.com aa]# ll
total 16
-rw-r--r--. 1 root root     0 Dec 16 19:44 1.jgp
-rw-r--r--. 1 root root     0 Dec 16 19:44 2.jsp
-r--r--r--. 1 root root     0 Dec 16 19:44 3.txt
-rw-r----x. 1 root root     6 Dec 16 18:52 a.txt
drwxr-xr-x. 2 root root    42 Dec 16 19:59 bb
-rw-r--r--. 1 root root 10240 Dec 16 19:22 my.tar
[aaa@qq.com aa]#

  • 修改文件的拥有者和组 chown  (change own)
[aaa@qq.com ~]# cd /home
[aaa@qq.com home]# ll
total 12
drwx------. 15 cr121  cr121  4096 Dec 15 04:31 cr121
drwx------. 17 hadoop hadoop 4096 Dec 15 01:52 hadoop
-rw-r--r--.  1 root   root     39 Dec 12 07:01 test.txt
[aaa@qq.com home]# chown hadoop:hadoop test.txt
[aaa@qq.com home]# ll
total 12
drwx------. 15 cr121  cr121  4096 Dec 15 04:31 cr121
drwx------. 17 hadoop hadoop 4096 Dec 15 01:52 hadoop
-rw-r--r--.  1 hadoop hadoop   39 Dec 12 07:01 test.txt
[aaa@qq.com home]#

  • 递归修改用户组和用户  chown -R root:root xxx
[aaa@qq.com ~]# chown -R hadoop:hadoop aaa
[aaa@qq.com ~]# ll
total 12
dr-xr-xr-x.  3 hadoop hadoop   16 Dec 15 05:26 aaa
drwxr-xr-x. 22 root   root   4096 Nov 29 01:48 anaconda3
-rw-------.  1 root   root   2741 Nov 23 20:24 anaconda-ks.cfg
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Desktop
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Documents
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Downloads
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Music
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Pictures
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Public
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Templates
-rw-r--r--.  1 root   root     21 Dec 12 05:46 test.txt
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Videos
[aaa@qq.com ~]# cd aaa
[aaa@qq.com aaa]# ll
total 0
drwxr-xr-x. 3 hadoop hadoop 16 Dec 15 05:27 bbb
[aaa@qq.com aaa]# cd bbb
[aaa@qq.com bbb]# ll
total 0
drwxr-xr-x. 2 hadoop hadoop 6 Dec 15 05:27 ccc
[aaa@qq.com bbb]#

  • 递归修改权限   chmod  -R 777 xxx (修改为读写操作权限)
[aaa@qq.com ~]# chmod -R 777 aaa
[aaa@qq.com ~]# ll
total 12
drwxrwxrwx.  3 hadoop hadoop   16 Dec 15 05:26 aaa
drwxr-xr-x. 22 root   root   4096 Nov 29 01:48 anaconda3
-rw-------.  1 root   root   2741 Nov 23 20:24 anaconda-ks.cfg
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Desktop
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Documents
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Downloads
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Music
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Pictures
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Public
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Templates
-rw-r--r--.  1 root   root     21 Dec 12 05:46 test.txt
drwxr-xr-x.  2 root   root      6 Nov 29 00:47 Videos
[aaa@qq.com ~]# cd aaa
[aaa@qq.com aaa]# ll
total 0
drwxrwxrwx. 3 hadoop hadoop 16 Dec 15 05:27 bbb
[aaa@qq.com aaa]# cd bbb
[aaa@qq.com bbb]# ll
total 0
drwxrwxrwx. 2 hadoop hadoop 6 Dec 15 05:27 ccc
[aaa@qq.com bbb]#

  • 创建连接文件
-    文件
d   目录
l    link链接
b   block块设备
c   charactor  字符文件

硬链接:两个文件实时备份,修改的时候处于同步状态,删除的时候不同步
硬链接两个文件占用相同的磁盘空间,一般采用符号链接‘
ln  xxx  xxx_link
硬链接不能为为文件夹创建链接,只能为文件创建链接
[aaa@qq.com aa]# ll
total 4
-rw-r--r--. 1 root root 6 Dec 15 05:45 test.txt
[aaa@qq.com aa]# ln test.txt test1.txt
[aaa@qq.com aa]# ll
total 8
-rw-r--r--. 2 root root 6 Dec 15 05:45 test1.txt
-rw-r--r--. 2 root root 6 Dec 15 05:45 test.txt
[aaa@qq.com aa]# echo xxx>>test.txt
[aaa@qq.com aa]# ll
total 8
-rw-r--r--. 2 root root 10 Dec 15 05:48 test1.txt
-rw-r--r--. 2 root root 10 Dec 15 05:48 test.txt
[aaa@qq.com aa]# echo yyy>>test1.txt
[aaa@qq.com aa]# ll
total 8
-rw-r--r--. 2 root root 14 Dec 15 05:48 test1.txt
-rw-r--r--. 2 root root 14 Dec 15 05:48 test.txt
[aaa@qq.com aa]#