Shell和Bash介绍

Shell是硬件和软件之间的交互界面。Bash是一种shell,在Linux系统中比较常见。我目前使用的Mac用的Z shell(zsh). 可以在terminal里面通过zsh命令对系统进行操作。这是与Windows所见所得,用鼠标点相比,Mac和Linux都可以完全用命令操作。常用的Bash/zsh命令如下:

Bash语言学习主要靠多用,慢慢积累。遇到需求多找资料,常学常用吧。

File and Directory Operations
bash 复制代码
ls                 # List files
ls -l              # Long listing with details
cd /path/to/dir    # Change directory
pwd                # Show current directory
mkdir newdir       # Create directory
touch file.txt     # Create empty file
rm file.txt        # Delete file
rm -r dir/         # Delete directory and contents
cp file1 file2     # Copy file
mv old new         # Move or rename file
Viewing and Editing Files
bash 复制代码
cat file.txt       # Show file contents
less file.txt      # View file page-by-page
head file.txt      # First 10 lines
tail file.txt      # Last 10 lines
nano file.txt      # Open in Nano editor
vim file.txt       # Open in Vim editor
参考资料
相关推荐
fpcc35 分钟前
跟我学c++中级篇——理解类型推导和C++不同版本的支持
开发语言·c++
莱茵菜苗1 小时前
Python打卡训练营day46——2025.06.06
开发语言·python
爱学习的小道长1 小时前
Python 构建法律DeepSeek RAG
开发语言·python
背太阳的牧羊人1 小时前
sudo docker exec -it backend bash 以交互方式(interactive)进入正在运行的 Docker 容器的命令行环境
docker·容器·bash
luojiaao1 小时前
【Python工具开发】k3q_arxml 简单但是非常好用的arxml编辑器,可以称为arxml杀手包
开发语言·python·编辑器
终焉代码1 小时前
STL解析——list的使用
开发语言·c++
SoFlu软件机器人1 小时前
智能生成完整 Java 后端架构,告别手动编写 ControllerServiceDao
java·开发语言·架构
英英_1 小时前
视频爬虫的Python库
开发语言·python·音视频
猛犸MAMMOTH2 小时前
Python打卡第46天
开发语言·python·机器学习
多多*2 小时前
微服务网关SpringCloudGateway+SaToken鉴权
linux·开发语言·redis·python·sql·log4j·bootstrap