在Linux系统中,可以通过以下目录和方式快速查找常用命令及相关文档:
/bin
:存放普通用户可用的基础命令(如 ls
, cp
, mv
)/sbin
:存放系统管理员用的命令(如 fdisk
, iptables
)/usr/bin
:用户安装的应用程序命令/usr/sbin
:系统管理员安装的高级命令/usr/share/man
:所有命令的手册页(Manual Pages)
man <命令>
查看(如 man ls
)/usr/share/doc
:部分软件包的详细文档which
:查找命令的绝对路径bash
which ls # 输出:/bin/ls
whereis
:查找命令及其手册和源码位置bash
whereis python
type
:判断命令类型(内置/外部)bash
type cd # 输出:cd is a shell builtin
功能 | 常用命令示例 |
---|---|
文件操作 | ls , cp , mv , rm , chmod |
文本处理 | cat , grep , awk , sed |
系统管理 | top , ps , df , free |
网络 | ping , ifconfig , netstat |
压缩解压 | tar , gzip , zip |
bash
man -k <关键词> # 搜索相关命令(如 `man -k "list files"`)
bash
tldr ls # 需要先安装 `npm install -g tldr`
将常用命令保存到 ~/.bashrc
或 ~/.zshrc
:
bash
alias ll='ls -alF'
alias myip='curl ifconfig.me'
通过以上方式,你可以快速定位和学习Linux命令。如需具体命令用法,随时可以提问!