Coder 灰桑

Stay Foolish, Always Foolish

命令行备忘

用到一个记一个。

创建文件

创建 helloword.txt 文件
touch helloword.txt

创建文件夹

创建 html 文件夹
mkdir html

展示文件内容

展示 helloword.txt 文件内容
cat helloword.txt

查看当前文件夹

pwd

Finder 打开当前路径的文件夹

open .

移动文件和文件夹

mv file_to_move destination_directory
mv directory_to_move destination_directory

重命名文件

mv old_file_name new_file_name

拷贝文件和文件夹

cp file_to_copy new_file_name

拷贝文件夹需要加 -r 参数
cp -r directory_to_copy new_directory_name

删除文件和文件夹

rm file_name

删除文件夹需要加 -r 参数
rm -r directory_name

利用上一个命令的最后一个参数

mkdir ~/Desktop/html
cd !$ 执行此命令会自动生成命令 
cd ~/Desktop/html
🔙  在 Playground 中编译 SwiftUI 的代码
Git 命令备忘  🔜