惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
CERT Recently Published Vulnerability Notes
U
Unit 42
T
The Blog of Author Tim Ferriss
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog RSS Feed
Microsoft Azure Blog
Microsoft Azure Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Securelist
L
Lohrmann on Cybersecurity
Blog — PlanetScale
Blog — PlanetScale
Recorded Future
Recorded Future
D
DataBreaches.Net
Spread Privacy
Spread Privacy
T
Threat Research - Cisco Blogs
I
Intezer
P
Palo Alto Networks Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
I
InfoQ
宝玉的分享
宝玉的分享
Security Latest
Security Latest
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threatpost
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
博客园 - 司徒正美
H
Hacker News: Front Page
Y
Y Combinator Blog
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
NISL@THU
NISL@THU
月光博客
月光博客
有赞技术团队
有赞技术团队
Cloudbric
Cloudbric
酷 壳 – CoolShell
酷 壳 – CoolShell
G
Google Developers Blog
A
Arctic Wolf
博客园 - 【当耐特】
W
WeLiveSecurity
V
Visual Studio Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
V
V2EX
C
Cyber Attacks, Cyber Crime and Cyber Security
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Stack Overflow Blog
Stack Overflow Blog

北海虽赊,扶摇可接

博客同步 - 腾讯云 - 微信 EMC 知识总结 - EMC - 硬件设计 一篇文章让你彻底掌握 Shell - Linux - 工具 《华为是怎样对待供应商的》 - 职场 - 工作 《Git 知识点整理》 - Git - 工具 话术 - 职场 - 工作 复杂度分析 - 综合 - 数据结构和算法 - 软件 代码工程规范 - 工作效率 - 工作 个人目录管理规范 - 工作效率 - 工作 技术文档规范 - 工作效率 - 工作 嵌入式编程技巧项目启动说明书 - 工作效率 - 工作 《常用 shell 命令整理之操作文件和目录 3》 - Linux - 工具 《常用 shell 命令整理之操作文件和目录 2》 - Linux - 工具 《常用 shell 命令整理之操作文件和目录 4》 - Linux - 工具 《软件工程之美》笔记 - 笔记 - 软件 《软件工程》笔记 - 笔记 - 软件 《硬件设计经验谈》 - 硬件设计 | Metalheart = 北海虽赊,扶摇可接 = 「 勇敢者是到处有路可走的 」 《职场求生攻略》 - 职场 - 工作
《常用 shell 命令整理之操作文件和目录 1》 - Linux - 工具
本文作者: Metal-Heart @北海虽赊,扶摇可接 · 2021-10-10 · via 北海虽赊,扶摇可接

# 1. touch - 创建文件

touch 命令就可用于创建、变更和修改文件的时间戳。它是 Linux 操作系统的标准程序。 touch 命令又如下选项:

-a: 只改变访问时间 
-c: 不创建任何文件
-m: 只改变修改时间
-r: 使用指定文件的时间替代当前时间
-t: 使用 [[CC]YY]MMDDhhmm[.ss] 替代当前时间

touch 命令的常见用法如下:

touch effyl
touch effyl myeffyl lueffyl
touch -a effyl
touch -c effyl
touch -m effyl
touch -c -t YYMMDDHHMM filename
touch -r myeffyl effyl

# 2.mkdir - 创建目录

mkdir 命令用于创建一个新目录。最基本的 mkdir 命令的使用方法如下所示:

mkdir <dirname>
mkdir backup/old
mkdir /home/blinkfox/backup/old
mkdir -p backup/old
mkdir -p -m 777 backup/old

# 3.cp - 复制文件或目录

cp 命令用于将文件从一个地方复制到另一个地方。原来的文件保持不变,新文件可能保持原名或用一个不同的名字。

使用 cp 命令复制文件和目录的语法有以下几种:

cp [OPTION] SOURCE DEST
cp [OPTION] SOURCE... DIRECTORY
cp [OPTION] -t DIRECTORY SOURCE...

常用使用示例如下:

cp file.txt newfile.txt
cp file.txt /tmp
cp * /tmp
cp -p filename /path/to/new/location/myfile
cp -R * /home/blinkfox/backup

# 4.ln - 链接文件或目录

ln 命令用于创建软链接或硬链接。使用 -s 选项,可以创建一个软链接:

ln -s /home/blinkfox/src/library.so /home/blinkfox/lib
ln -s /home/blinkfox/src source

# 5. mv - 移动文件或目录

mv 命令用于将文件和目录从一个位置移到另外一个位置。除了移动文件, mv 命令还可用于修改文件或目录的名字。

mv 命令的基本语法如下所示:

mv SOURCE... DIRECTORY

常用命令如下:

mv source.txt /tmp
mv dir1 dir2 dir_dist
mv old.txt new.txt
mv -i old.txt new.txt
mv * /tmp/
mv -u dir1/* dir2/

# 6.rm - 删除文件或目录

rm 命令用于删除指定的文件和目录。其语法如下所示:

rm [OPTIONS]... FILE...

rm 的常用命令如下:

rm file1.txt file2.txt file3.txt
rm *
rm ~/temp/*
rm -i *
rm *.doc
rm *movie*
rm a*
rm ???
rm *.??
rm *[abc]*
rm *[0-9]*
rm *.[ch]
rm -rf /tmp/*

-f 删除前不提示用户确认,并忽略不存在的文件

-r 递归地删除目录及其下的内容