Operators | && - and, || - or |
apropos | Returns all documentation containing the defined command |
bzip/bunzip - bzip | Compresses files |
cat | Outputs the contents of a file |
cd | Change directory |
chmod | Change file mode |
chown | Change ownership |
clear | Clears the screen |
cp | Copy Options -f Force; will overwrite any existing files with the same name -i Interactive; will ask to overwrite -p Preserves file ownership -r Recursive; will copy files under directories -a Archive; preserve symlinks -u Copy only if original file is newer |
cut | Manipulate data by columns Options -c Range to cut [-c2-4] -d Define a deliminator to use with fields -f Return the numbered field |
dig | Look up IP addresses and DNS names |
env | Show environmental variables for current user |
exit | Terminates all current processes, including shell |
find | Locate file in system |
finger | Used to find out information regarding a user |
free | Reports on system memory |
grep | search for string Options -i Case insensitive -n Include line number in output |
groupadd | Add group Options -g Group ID -p Password -r Create system group |
groupmod | Modify group Options -g GID -p Password |
head | Output the first ten lines of a file |
halt | Shuts down operating system |
id | Outputs user and group IDs for a user Options -u Show only UID -g Show only GID -G Show all groups to which a user belongs -Gn Group name |
if | Conditional statements in bash scripting Options -d See if directory exists -e See if file exists -f See if file exists and it is a regular file -G See if file exists and it is owned by a defined group -h See if file exists and it is symlinked -L See if file exists and it is symlinked (same as -h) -O See if file exists and it is owned by defined UID -r See if file exists and has read permissions -w See if file exists and had write permissions -x See if file can be executed |
ifconfig | Shows NIC for network card; configures network settings |
info | Improved manual pages |
init 0 | Shuts down operating system |
init 6 | Reboots the operating system |
ipaddr | Replaces ifconfig on newer systems |
last | hows last command used by defined user |
less | Opens file in a vim-like environment for viewing |
ln | link files Option -s Create symbolic link |
ls | List contents of directory Options -a List all files, including hidden files -l List files, including details such as owner and permissions -p Adds a / to the end of directories -R Enable recursion, including all sub-directories |
man | Manual pages 1 Executable programs and shell commands 2 System calls for the kernel 3 Library calls 4 Device files 5 File formats 6 Games 7 Misc. 8 Programs only run by the root user 9 Kernel routines -k Returns all documentation containing search keyword (apropos) |
mv/move | Used to move or rename files Options -m Set permissions mode -p Force recursion |
netstat | Shows network status Options -a All listening and non-listening sockets -i Network interface statistics -l Listening sockets -s Summary of each protocol |
passwd | Change/set password Options -S View password settings -l Locks account -u Unlocks account -d Remove password -n Set days before password change -x Set maximum days before password change -w Days to warn prior to password reset -i Days to wait after expired password to disable account |
ping | Test connectivity of remote network device |
ps | Process status Options -u Define user |
pwck | Verifies the integrity of the password files |
pwconv | Syncs /etc/passwd and /etc/shadow |
pwd | Print working directory |
reboot | Shuts down, then restarts the system |
route | View routing tables |
set - similar to env | Works with environment variables |
sort | Sorts text in file Options -r Sort in reverse order -n Sort numerically |
su | Substitute user |
sudo | Run command as root |
tail | Outputs the last ten lines of a file |
rm | Remove Option -r Enable recursion |
rmdir | Remove directory |
shutdown | Shuts down the system Options -H Halts the machine -P Power off -r Reboot -h Equivalent to powering off, overridden by --halt -k Send warning, but perform no actions -c Cancel a shutdown |
su | Substitute user |
tar | Archives files Options -cf Create file -xf Extract file -v Verbose -zcf Archive with gzip -jcf Archive with bzip2 |
top | Shows list of current applications/processes, and system usage Options h Help k Input process ID to kill r Change process priorety p Sort by CPU usage m Sort by memory usage |
touch | Created empty file Options -c Will not create file if one exists; will update timestamp -d Manually set timestamp; can be used with directories |
traceroute | Traces the route a packet takes |
uname | Returns information related to the system Options -s Displays kernel name -n Displays hostname -r Kernel release number -v Kernel version number -m Hardware architecture -p Processor architecture -i Hardware platform -o Operating system -a All information |
useradd | Adds new user Options -D Outputs defaults -c Comment -e When to expire account -f Number of days after password expiration to disable account -g Default group -G Additional groups -M Do not create home directory -m Set home directory -p Define password -r Create system user -s Set default shell -u Define UID |
userdel | Delete user Option -r Delete home folder |
usermod | Modify user account Options -c Comment -e Expire date -f Days after password expiration to disable account -G Add groups -l Change username -L Lock account -m Move home directory -p Change password -u Set user ID -U Unlock account |
w | Displays user system information |
wc | Word count Options -w Count words -c Count characters |
whatis | Returns available man pages for command |
which | Shows location of application |
who | Displays who is logged in Options -b Last boot time of machine -m Hostname and associated user -r Run level for current user -q Number of logged-in users -a All |
whoami | Outputs username of current user |
zip/unzip - zip; | Compresses files |
经营者 | &&-和,|| - 要么 |
适当的 | 返回包含已定义命令的所有文档 |
bzip / bunzip-bzip | 压缩文件 |
猫 | 输出文件内容 |
光盘 | 变更目录 |
chmod | 变更档案模式 |
wn | 变更拥有权 |
明确 | 清除屏幕 |
cp | 复制 选件 -f力; 将会覆盖任何具有相同名称的现有文件 -i互动; 会要求覆盖 -p保留文件所有权 -r递归; 将复制目录下的文件 -存档; 保留符号链接 -u仅在原始文件较新时复制 |
切 | 按列处理数据 选件 -c切割范围[-c2-4] -d定义一个与字段一起使用的分隔符 -f返回编号字段 |
挖 | 查找IP地址和DNS名称 |
环保 | 显示当前用户的环境变量 |
出口 | 终止所有当前进程,包括shell |
找 | 在系统中找到文件 |
手指 | 用于查找有关用户的信息 |
自由 | 报告系统内存 |
grep | 搜索字符串 选件 -i不区分大小写 -n在输出中包括行号 |
组添加 | 新增群组 选件 -g组ID -p密码 -r创建系统组 |
组mod | 修改组 选件 -g GID -p密码 |
头 | 输出文件的前十行 |
停止 | 关闭操作系统 |
ID | 输出用户的用户ID和组ID 选件 -u仅显示UID -g仅显示GID -G显示用户所属的所有组 -Gn组名 |
如果 | bash脚本中的条件语句 选件 -d查看目录是否存在 -e查看文件是否存在 -f查看文件是否存在并且它是常规文件 -G查看文件是否存在,并且是否属于已定义的组 -h查看文件是否存在并且已被符号链接 -L查看文件是否存在并且已被符号链接(与-h相同) -O查看文件是否存在,并且由定义的UID拥有 -r查看文件是否存在并具有读取权限 -w查看文件是否存在并具有写权限 -x查看文件是否可以执行 |
ifconfig | 显示网卡的NIC; 配置网络设置 |
信息 | 改进的手册页 |
初始化0 | 关闭操作系统 |
初始化6 | 重新启动操作系统 |
伊帕德 | 在较新的系统上替换ifconfig |
持续 | 定义的用户使用的最后命令的方式 |
减 | 在类似vim的环境中打开文件进行查看 |
ln | 链接文件 选项 -s创建符号链接 |
ls | 列出目录内容 选件 -a列出所有文件,包括隐藏文件 -l列出文件,包括所有者和权限等详细信息 -p在目录末尾添加/ -R启用递归,包括所有子目录 |
男子 | 手册页 1可执行程序和外壳命令 2内核的系统调用 3图书馆电话 4个设备文件 5种文件格式 6游戏 7其他 8个程序仅由root用户运行 9个内核例程 -k返回所有包含搜索关键字(apropos)的文档 |
MV /移动 | 用于移动或重命名文件 选件 -m设置权限模式 -p强制递归 |
netstat | 显示网络状态 选件 -a所有监听和非监听套接字 -i网络接口统计 -l监听套接字 -s每个协议的摘要 |
密码 | 更改/设置密码 选件 -S查看密码设置 -l锁定帐户 -u解锁帐户 -d删除密码 -n设置密码更改前的天数 -x设置密码更改前的最长天数 -w密码重置前的警告天数 -i密码过期后等待几天才能禁用帐户 |
ping | 测试远程网络设备的连接 |
ps | Craft.io状态 选件 -u定义用户 |
w | 验证密码文件的完整性 |
pwconv | 同步/ etc / passwd和/ etc / shadow |
密码 | 打印工作目录 |
重启 | 关闭,然后重新启动系统 |
路线 | 查看路由表 |
设置-类似于env | 使用环境变量 |
分类 | 对文件中的文本进行排序 选件 -r反向排序 -n按数字排序 |
su | 替代用户 |
须藤 | 以root身份运行命令 |
尾巴 | 输出文件的最后十行 |
R M | 去掉 选项 -r启用递归 |
rmdir | 删除目录 |
关掉 | 关闭系统 选件 -H停止机器 -P关机 -r重新启动 -h等效于关闭电源,由--halt覆盖 -k发送警告,但不执行任何操作 -c取消关机 |
su | 替代用户 |
柏油 | 存档文件 选件 -cf创建文件 -xf提取文件 -v详细 -zcf使用gzip存档 -jcf使用bzip2存档 |
最佳 | 显示当前应用程序/进程和系统使用情况的列表 选件 h帮助 k输入要杀死的进程ID 变更流程优先级 p按CPU使用率排序 m按内存使用量排序 |
触摸 | 创建空文件 选件 -c如果存在则不创建文件; 将更新时间戳 -d手动设置时间戳; 可以与目录一起使用 |
跟踪路由 | 跟踪数据包采用的路由 |
ame | 返回与系统有关的信息 选件 -s显示内核名称 -n显示主机名 -r内核发行号 -v内核版本号 -m硬件架构 -p处理器架构 -i硬件平台 -o操作系统 -a所有信息 |
用户添加 | 添加新用户 选件 -D输出默认值 -c评论 -e帐户何时到期 -f密码到期后禁用帐户的天数 -g默认组 -G其他组 -M不创建主目录 -m设置主目录 -p定义密码 -r创建系统用户 -s设置默认外壳 -u定义UID |
用户名 | 删除用户 选项 -r删除主文件夹 |
用户模组 | 修改用户帐号 选件 -c评论 -e到期日期 -f密码过期后的天数以禁用帐户 -G添加组 -l更改用户名 -L锁定帐户 -m移动主目录 -p更改密码 -u设置用户ID -U解锁帐户 |
w | 显示用户系统信息 |
厕所 | 字数 选件 -w数词 -c计数字符 |
什么是 | 返回可用的手册页 |
哪一个 | 显示应用程序的位置 |
WHO | 显示谁登录 选件 -b机器的最后启动时间 -m主机名和关联的用户 -r当前用户的运行级别 -q登录的用户数 -全部 |
我是谁 | 输出当前用户的用户名 |
zip / unzip-zip; | 压缩文件 |
翻译自: https://www.includehelp.com/linux/linux-essentials-command-line-cheat-sheet.aspx