【Linux commands, ls -l, cd appointed route/path, mv, cp, rename】

2023-12-21 22:29:06

I) URL resources

II) Records of Linux training

[root@iZ2vc5lqzt23aweti4j777Z ~]# pwd
/root
[root@iZ2vc5lqzt23aweti4j777Z ~]# mkdir Dec21th2023_test1
[root@iZ2vc5lqzt23aweti4j777Z ~]# ls -al
total 108
dr-xr-x---.  8 root root  4096 Dec 21 21:03 .
dr-xr-xr-x. 18 root root  4096 Dec 19 10:22 ..
-rw-------   1 root root 10720 Dec 21 20:42 .bash_history
-rw-r--r--.  1 root root    18 May 18  2020 .bash_logout
-rw-r--r--.  1 root root   176 May 18  2020 .bash_profile
-rw-r--r--.  1 root root   176 May 18  2020 .bashrc
drwx------   3 root root  4096 Oct 11 11:49 .config
-rw-r--r--.  1 root root   100 May 18  2020 .cshrc
drwxr-xr-x   2 root root  4096 Dec 21 21:03 Dec21th2023_test1
drwxr-xr-x   2 root root  4096 Dec 19 19:52 folder_Dec19th2023
-rw-r--r--   1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm
-rw-------   1 root root  6707 Dec 21 16:47 .mysql_history
drwxr-xr-x  11 root root  4096 Dec 21 14:23 PbootCMS
drwxr-xr-x   2 root root  4096 Oct 11 11:38 .pip
-rw-r--r--   1 root root   206 Dec 19 10:22 .pydistutils.cfg
drwx------   2 root root  4096 Oct 11 11:47 .ssh
-rw-r--r--.  1 root root   129 May 18  2020 .tcshrc
-rw-r--r--   1 root root   168 Dec 19 16:22 .wget-hsts
[root@iZ2vc5lqzt23aweti4j777Z ~]# ls -l
total 40
drwxr-xr-x  2 root root  4096 Dec 21 21:03 Dec21th2023_test1
drwxr-xr-x  2 root root  4096 Dec 19 19:52 folder_Dec19th2023
-rw-r--r--  1 root root 25548 Apr  7  2017 mysql57-community-release-el7-10.noarch.rpm
drwxr-xr-x 11 root root  4096 Dec 21 14:23 PbootCMS
[root@iZ2vc5lqzt23aweti4j777Z ~]# cd Dec21th2023_test1/
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# pwd
/root/Dec21th2023_test1
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# touch Dec21th2023_a.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -a
.  ..  Dec21th2023_a.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 0
-rw-r--r-- 1 root root 0 Dec 21 21:06 Dec21th2023_a.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# vi Dec21th2023_a.txt 
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 4
-rw-r--r-- 1 root root 39 Dec 21 21:09 Dec21th2023_a.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# vi Dec21th2023_b.txt 
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 8
-rw-r--r-- 1 root root 39 Dec 21 21:09 Dec21th2023_a.txt
-rw-r--r-- 1 root root 50 Dec 21 21:12 Dec21th2023_b.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# mv Dec21th2023_a.txt Dec21st2023_a.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 8
-rw-r--r-- 1 root root 39 Dec 21 21:09 Dec21st2023_a.txt
-rw-r--r-- 1 root root 50 Dec 21 21:12 Dec21th2023_b.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# mv Dec21st2023_b.txt Dec21st2023_b.txt
mv: cannot stat 'Dec21st2023_b.txt': No such file or directory
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# mv Dec21th2023_b.txt Dec21st2023_b.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 8
-rw-r--r-- 1 root root 39 Dec 21 21:09 Dec21st2023_a.txt
-rw-r--r-- 1 root root 50 Dec 21 21:12 Dec21st2023_b.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# copy Dec21st2023_a.txt Dec21st2023_a1.txt
-bash: copy: command not found
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# copy Dec21st2023_a.txt Dec21st2023_a1.txt && rm Dec21st2023_a.txt
-bash: copy: command not found
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# cp Dec21st2023_a.txt Dec21st2023_a1.txt && rm Dec21st2023_a.txt
rm: remove regular file 'Dec21st2023_a.txt'? y
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 8
-rw-r--r-- 1 root root 39 Dec 21 21:27 Dec21st2023_a1.txt
-rw-r--r-- 1 root root 50 Dec 21 21:12 Dec21st2023_b.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ren
rename            renew-dummy-cert  renice            
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# rename Dec21st2023_a1.txt Dec21st2023_a.txt
rename: not enough arguments
Try 'rename --help' for more information.
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# rename --help

Usage:
 rename [options] <expression> <replacement> <file>...

Rename files.

Options:
 -v, --verbose       explain what is being done
 -s, --symlink       act on the target of symlinks
 -n, --no-act        do not make any changes
 -o, --no-overwrite  don't overwrite existing files

 -h, --help          display this help
 -V, --version       display version

For more details see rename(1).
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# rename Dec21st2023_a1.txt Dec21st2023_a.txt Dec21st2023_a1.txt 
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# ls -l
total 8
-rw-r--r-- 1 root root 39 Dec 21 21:27 Dec21st2023_a.txt
-rw-r--r-- 1 root root 50 Dec 21 21:12 Dec21st2023_b.txt
[root@iZ2vc5lqzt23aweti4j777Z Dec21th2023_test1]# 

文章来源:https://blog.csdn.net/DavidsonGong/article/details/135140958
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。