一些实用的linux命令

1、ls 按时间倒序查看,最上面的是最新的

[root@master1 ~]# ls -rtl
total 244
-rw-r--r--  1 root root   4637 Dec 21 12:24 haproxy-ingress.yaml
-rw-r--r--  1 root root 189295 Mar  8 14:12 calico.yaml
-rw-r--r--  1 root root  29438 Mar  8 15:32 openebs-operator.yaml
-rw-r--r--  1 root root   4000 Mar  8 17:25 components.yaml
-rw-------. 1 root root   1421 Mar 11 00:17 anaconda-ks.cfg
-rw-r--r--  1 root root   4902 Mar 11 23:36 kube.info

2、建立软链接  ln -s /opt/test  test    解释  ln -s 真实目录  软连接目录

[root@master1 test]# ln -s /opt/test/ test
[root@master1 test]# ls
test
[root@master1 test]# ll
total 0
lrwxrwxrwx 1 root root 10 Mar 12 15:14 test -> /opt/test/

3、查看软连接对应的实际目录  

[root@master1 test]# readlink -f test/
/opt/test

4、将两个文件合并 

paste a b                                  # 将两个文件合并用tab键分隔开
paste -d'+' a b                            # 将两个文件合并指定'+'符号隔开

5、拷贝不提示 

\cp a.txt b
[root@master1 ~]# cp a.txt b
[root@master1 ~]# cp a.txt b
cp: overwrite ‘b’? ^C
[root@master1 ~]# \cp a.txt b
[root@master1 ~]#

6、转换文件编码

iconv -f gbk -t utf8 source.txt > new.txt  # 转换编码

 

posted @ 2021-03-12 15:32  s。  阅读(91)  评论(0编辑  收藏  举报