linux中的常用命令

简介: linux中的常用命令

alias alias command='command' # 定义别名
bg bg jobspec # 将作业放到后台执行
break break n # 在循环或条件语句中跳出n次循环
cd cd dir_name # 切换目录
command command args... # 执行命令和参数
complete complete word # 完成命令补全
continue continue n # 在循环或条件语句中继续执行下一次循环
declare declare var_name type # 定义变量
echo echo args... # 输出一行文本
echo -n arg # 输出一行文本,但不换行
exit exit status # 退出程序
export export var_name # 将变量导出到其他进程
eval eval command # 执行命令和参数
exec exec command # 执行命令并替换当前进程
exit exit status # 退出程序
for for var_name in seq; do command; done # 循环执行命令
foreach foreach var_name in seq; do command; done # 循环执行命令
function function_name() { command; } # 定义函数
getopts getopts optstring args # 解析命令行参数
hash hash -d command # 缓存命令的位置
help help command # 显示命令的帮助文档
if if condition; then command; fi # 执行条件语句
import import var_name # 将变量导入到当前进程
jobs jobspec # 查看后台作业
jobctl jobctl command jobspec # 控制后台作业
kill kill signal_num jobspec # 终止作业
let let expression # 计算表达式的值
local var_name value # 定义局部变量
login login # 登录到系统
logout logout # 退出登录
mapfile mapfile file_name # 将文件内容读入到数组中
source source file_name # 执行文件中的命令
time time command # 记录命令的执行时间
trap trap signal_num command # 设置信号处理程序
type type command # 显示命令的类型
ulimit ulimit -a # 显示当前的资源限制
unalias unalias command # 删除别名
unset unset var_name # 删除变量
wait wait jobspec # 等待作业完成
while while condition; do command; done # 执行循环
yes yes command # 以“y”作为参数连续执行命令
. . file_name # 执行文件中的命令
ab # 显示HTTP请求的吞吐量
apropos apropos keyword # 搜索命令
aspell aspell word # 拼写检查单词
at # 安排作业在未来执行
au # 显示用户的自定义别名
automount # 自动挂载分区
bash # 执行Bourne shell
bsdgames # 打开 BSD 游戏
cal # 显示日历
cat # 显示文件内容
cd # 切换目录
chflags chflags flags file # 设置文件的文件属性
chgrp chgrp group file # 更改文件的组
chmod chmod mode file # 更改文件的权限
chown chown owner file # 更改文件的所有者
chsh chsh user # 更改用户的shell
clear # 清屏
cmp cmp file1 file2 # 比较文件的内容
comm comm file1 file2 # 比较两个文件的内容
contrast contrast # 显示文本对比度
cp cp file1 file2 # 复制文件
crontab crontab file # 编辑定时任务
cut cut -d delimiter -f field_num file # 提取文件中的字段
date date format # 显示当前时间
dbenv dbenv init # 初始化DBEnv环境
dd if=input_file of=output_file bs=block_size count=count # 块级复制文件
declare declare var_name type # 定义变量
df df -h # 显示磁盘空间使用情况
diff diff file1 file2 # 比较两个文件的差异
dir dir -l # 显示当前目录的详细信息
dir -b # 显示当前目录的简单信息
dir -c # 显示当前目录的计数信息
dir -d # 显示当前目录的深度信息
dir -h # 显示当前目录的大小信息
dir -l # 显示当前目录的详细信息
dir -p # 显示当前目录的绝对路径
dir -s # 显示当前目录的大小信息
dir -w # 显示当前目录的宽度信息
du du -bh # 显示文件和目录的大小
echo echo args... # 输出一行文本
ed ed file # 编辑文件
env env # 显示环境变量
export export var_name # 将变量导出到其他进程
expr expr expression # 计算表达式的值
fact fact n # 计算n的阶乘
find find path -name name # 查找文件
find find path -mtime n # 查找最近n天修改过的文件
find find path -type type # 查找指定类型的文件
find find path -user user # 查找指定用户的文件
find find path -group group # 查找指定组的文件
find find path -mtime n # 查找最近n天修改过的文件
find find path -name name # 查找文件
find find path -type type # 查找指定类型的

相关实践学习
CentOS 7迁移Anolis OS 7
龙蜥操作系统Anolis OS的体验。Anolis OS 7生态上和依赖管理上保持跟CentOS 7.x兼容,一键式迁移脚本centos2anolis.py。本文为您介绍如何通过AOMS迁移工具实现CentOS 7.x到Anolis OS 7的迁移。
目录
相关文章
|
4天前
|
Linux Python Perl
Linux命令删除文件里的字符串
Linux命令删除文件里的字符串
16 7
|
4天前
|
Shell Linux
Linux shell编程学习笔记82:w命令——一览无余
Linux shell编程学习笔记82:w命令——一览无余
|
24天前
|
Linux Shell
Linux 中 Tail 命令的 9 个实用示例
Linux 中 Tail 命令的 9 个实用示例
63 6
Linux 中 Tail 命令的 9 个实用示例
|
21天前
|
设计模式 Java Linux
Linux的20个常用命令
Linux的23个常用命令
Linux的20个常用命令
|
6天前
|
Linux Perl
Linux之sed命令
Linux之sed命令
|
6天前
|
Linux
深入理解Linux中的cp命令:文件与目录的复制利器
深入理解Linux中的cp命令:文件与目录的复制利器
|
6天前
|
Linux Docker 容器
9. 同步执行Linux多条命令
9. 同步执行Linux多条命令
|
6天前
|
Linux Shell
10-10|linux命令查询 关键字在文本中出现的行数
10-10|linux命令查询 关键字在文本中出现的行数
|
7天前
|
存储 Linux Shell
常用vim命令和vim基本使用及Linux用户的管理,用户和组相关文件
这篇文章介绍了Vim编辑器的基本使用、常用命令和模式,以及Linux系统中用户和组的管理方法,包括用户和组相关文件如/etc/passwd、/etc/shadow和/etc/group的说明。
常用vim命令和vim基本使用及Linux用户的管理,用户和组相关文件
|
8天前
|
Linux Docker 容器
linux之docker命令
linux之docker命令
下一篇
无影云桌面