[Bash] Operations against Folder
Open folder
When you want to open a folder in Finder, for example your current folder:
open .
open .git ## you can open the hidden folder
Create folder
Create a single folder
mkdir folder
You can also create nested folders
mdkir -p a/b/c
It will create a folder c
inside folder b
inside folder a
.
Remove folder
Note that the rm command permanently deletes a file. It doesn't move it to the trash or anything. If we want to remove a folder, we can't just use plain rm
.
rm by default only removes files. If we pass the -r
flag that will tell it to recursively remove the folder and everything in it.
Oftentimes, you'll see rm used with the -r
flag and the -f
flag. The -f
flag is a sort of a nuclear option. It prevents Bash from prompting you for confirmation when you remove a file, as well as erroring out if a file or directory doesn't exist. If we do that on a, that will remove that folder and all of its contents, as well.
rm folder/
rm -r folder/
rm -rf a/
Rename a folder
Rename src
folder to lib
folder
mv src/ lib
Find folders
Find all folders under current dir:
find . -type d
The same as ls -G
.
Find all folders under current dir which named "images":
find . -type d -name "images"
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2019-02-08 [Functional Programming ADT] Debug a Functional JavaScript composeK Flow
2019-02-08 [Functional Programming ADT] Initialize Redux Application State Using The State ADT
2019-02-08 [Angular] Angular i18n Pluralization Support
2018-02-08 [ReactVR] Render Custom 3D Objects Using the Model Component in React VR
2018-02-08 [ReactVR] Add Lighting Using Light Components in React VR
2018-02-08 [ReactVR] Add Shapes Using 3D Primitives in React VR
2017-02-08 [NPM] Add comments to your npm scripts