Linux 常用命令

来源:互联网 发布:mac手写输入法怎么取消 编辑:程序博客网 时间:2024/06/16 11:03

查询类命令

命令 常用参数 原意 所在目录 作 用 cd [..] [~] [.] [-] [./] change directory Shell pwd -L -P print name of current/working directory /bin/ 查询当前工作目录 whatis what is it ? Shell 简单查询命令 whereis where is it /usr/bin/ 命令或文件所在位置查询 which which /usr/bin/ 搜索所在目录及别名信息 umask the user file creation mask Shell 查看当前新建文件的权限 lasttr -a -d 查看目录特殊权限 getfacl -s -a -d ACL /usr/bin/ 查看ACL权限 ls -a -l -h -F -id list /bin/ 查看当前目录详细文件列表和文件属性 df -a -h -m disk /bin/ 查询分区挂载信息 mount -l -a -t -L -o mount /bin/ 挂载点命令 du -a -h -s /usr/bin/ 查看目录大小 last -n -a -i last /usr/bin/ 查询用户登陆信息 last log lastlog -b -t -u /usr/bin/ 用户最后登陆时间查询 ifconfig interface configure /sbin/ 查询网络信息 traceroute traceroute /usr/sbin/ 查询数据包经过路径 runlevel Level /sbin/ 查询当前系统运行等级 info info /usr/bin/ 常用帮助命令 man 1~8 manual pages /usr/bin/ 帮助命令 env set bind pstree history free help

操作类命令

命令 常用参数 原意 所在目录 作 用 备注 useradd [用户名] passwd [用户名] touch touch /bin/touch 新建空文件| mkdir -p make directories /bin/mkdir 新建空目录 rmdir remove empty directory /bin/rmdir 删除空目录 rm -r -f remove /bin/rm 删除文件 cp -r -p -u copy /bin/cp 复制 mv -u -f move /bin/mv 剪接文件+改名 rename 批量改名命令 basename 获取文件名 dirname 获取目录名 ln -s link /bin/ln 目录链接命令 不能跨分区 nl -n(ln rn rz) 显示文件带序号,序号可以自定义 cat -n -A -b cat /bin/cat 短文件查看 head -n head /usr/bin/ 文件头查看命令 tac tac /usr/bin/ 文件尾开始查看 tail -n -f tail /usr/bin/tail 文件尾 动态监视命令 more 空格或f Enter q Q more /bin/more 文件查看,适合大文件 less 翻页键 空格 箭头 / n q less sur/bin/ 带查找功能的文件查看器 find -n name find /bin/find 搜索命令,占用资源大 locate -i updatedb locate /usr/bin/locate 速度快的索引搜索工具 grep -iv -i -v grep /bin/grep 文件内容内查找命令 dd

文件系统&操作

命令 常用参数 原意 所在目录 作 用 备注 dumpe2fs 后接[分区设备名] 查看系统分区详细信息,UUID,格式等等.. fsck -a -y 文件系统修复命令,不建议自己操作,系统会自动调用 od -a -c -d -u -x 二进制方式显示文件

文件操作命令

命令 常用参数 原意 所在目录 作 用 备注 chmod u g o a change the permission mods of a file chmod[SUID] 7755 5755 2755 SUID权限设置 chown [新用户][文件] change file ownership 修改文件所有者. chgrp [新组][文件] change file group owership grep sed awk vim dos2unix -k -n unix2dos iconv -f from -t to -o -l 文件编码转换

文件状态查询

命令 常用参数 原意 所在目录 作 用 备注 w 查看负载,用户空闲 uptime who 查看当前在线用户 last 查看最后登录用户信息

压缩&备份命令

命令 查看包内容 压缩命令 解压命令 扩展名 备注 file tar -[j/z]tvf[filename] -[j/z]cv -f[新包名][压缩目标] -[j/z]xv -f[新包名][-C目录/压缩对象] .tar.[bz2/gz] gzip zcat [压缩包] -cv -[1~9][打包目标] -d/gunzip[包名] 默认压缩后不保留源文件,>[新名] bzip2 bzcat [压缩包] -cvk -[1~9][打包目标] -d/bunzip[包名] 备份操作 查看命令 tar -jtvf [备份名] -jcvf [储存名] [备份目标] dump -juv0 -f [Newfile.dump] [Target] cpio dd

Shell

常用运算符

网络命令

0 0
原创粉丝点击