mac上linux常用命令
mac上linux常用命令详细介绍
Mac 基于 Unix 内核,许多 Linux 命令在 Mac 上同样适用。下面为你介绍一些常用的 Linux 命令及其在 Mac 上的使用方法:
文件和目录操作
ls:用于列出目录内容。
bash
cd:用于切换当前工作目录。
bash
/path/to/directory~
mkdir:用于创建新的目录。
bash
new_directory
rm:用于删除文件或目录。
bash
file.txtdirectory
cp:用于复制文件或目录。
bash
file.txt new_file.txtsource_directory destination_directory
mv:用于移动或重命名文件和目录。
bash
file.txt new_location/old_name.txt new_name.txt
文件内容查看
cat:用于查看文件内容。
bash
file.txt
more:分页查看文件内容。
bash
large_file.txt
less:与more类似,但功能更强大。
bash
large_file.txt
head:查看文件开头部分内容。
bash
file.txt
tail:查看文件结尾部分内容。
bash
file.txt
权限管理
chmod:用于更改文件或目录的权限。
bash
+x script.sh
chown:用于更改文件或目录的所有者。
bash
new_owner file.txt
系统信息
uname:显示系统信息。
bash
df:显示磁盘使用情况。
bash
du:显示目录或文件的磁盘使用情况。
bash
directory
进程管理
ps:显示当前运行的进程。
bash
aux
top:实时显示系统中各个进程的资源占用状况。
bash
912
kill:用于终止进程。
bash
912
这些命令可以帮助你在 Mac 上进行基本的文件操作、系统管理等。你可以在终端中输入这些命令来尝试使用。