linux 操作指令及常识

简单操作命令

  1. 清屏  clear   Ctrl+L 
  2. 终止一个命令     Ctrl+C
  3. 编辑命令  a
  4. 重新启动虚拟机   init 6 
  5. 关机  poweroff
  6. 帮助手册 外部命令 man   内部命令 help    例如: help  cd
  7. 下载安装  install   例如 要查询一个命令 输入 man yum   然后输出  man command is not  found 
  8. 则 可以下载安装对应的包  输入 yum install man -y
  9. 通过  ping 命令可以测试网络通不通
  10. 在当前目录及其子目录所有的.cpp文件中查找字符串"example"   
    grep -i -r example ./*.cpp

  11. 查看环境变量表示当前路径  PWD
  12. 使用 df 命令查看硬盘被占用了多少空间和剩余多少空间
  13. 有两台游戏服务器运行于linux 2.6.x内核上,使用 rsync 命令 来同步用户访问日志
  14. 使用last命令可以查看曾经登录到此系统的用户清单
  15. hosts 存放在etc目录下面,是Linux系统负责将主机名映射到IP的文件,所以当内网内没有条件建立dns服务器,又不想用IP访问网站,应配置hosts文件
  16. ls是list的缩写,用来显示当前目录下面文件的信息;
  17. df是disk free的缩写,用来显示文件系统中不同磁盘的使用情况;
  18. du是disk usage的缩写,显示当前目录或者当前文件的占用的块大小;
  19. find命令作用在目录下,用来查找指定目录或者当前目录下的文件。
  20. 可以打印文件(demo.log)中包含ERP的行到标准输出   sed -n '/ERP/p' demo.log
  21. linux中用使用tar命令将文件aaa打包为bak.tar   tar -cf bak.tar  aaa
  1. 文件权限 : 三个类别的权限:u-文件所属主 g-文件所属组 o-其他用户 (用户/所有者 组内用户 组外用户)
  2. 、文件权限:r-读(4) w-写(2) x-可执行(1)
  3. 如:-r-xr-x--x为551。最前面的-表示文件类型,如果是文件用-表示,如果是文件夹用d表示,如果是连接文件用l表示
  4. 权限为765的文件 权限位标记:-rwxrw-r-x
  5. 某文件的组外成员的权限为只读;所有者有全部权限;组内的权限为读与写,则该文件的权限为_764_ 

不管什么命令 都可以通过 type 查询   

type命令用来显示指定命令的类型。一个命令的类型可以是如下之一

  • alias 别名
  • keyword 关键字,Shell保留字
  • function 函数,Shell函数
  • builtin 内建命令,Shell内建命令
  • file 文件,磁盘文件,外部命令
  • unfound 没有找到

知道了是那种类型,我们就可以针对性的获取帮助。比如内建命令可以用help命令来获取帮助,外部命令用man或者info来获取帮助。

type命令的基本使用方式就是直接跟上命令名字。

type -a可以显示所有可能的类型,比如有些命令如pwd是shell内建命令,也可以是外部命令。

type -p只返回外部命令的信息,相当于which命令。

type -f只返回shell函数的信息。

type -t 只返回指定类型的信息。

常见命令的类型

[root@new55 ~]# type -a cd 
cd is a shell builtin
[root@new55 ~]# type -a pwd 
pwd is a shell builtin
pwd is /bin/pwd
[root@new55 ~]# type -a time 
time is a shell keyword
time is /usr/bin/time
[root@new55 ~]# type -a date 
date is /bin/date
[root@new55 ~]# type -a which 
which is aliased to `alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
which is /usr/bin/which
[root@new55 ~]# type -a whereis 
whereis is /usr/bin/whereis
[root@new55 ~]# type -a whatis 
whatis is /usr/bin/whatis
[root@new55 ~]# type -a function 
function is a shell keyword
[root@new55 ~]# type -a ls 
ls is aliased to `ls --color=tty'
ls is /bin/ls
[root@new55 ~]# type -a ll 
ll is aliased to `ls -l --color=tty'
[root@new55 ~]# type -a echo 
echo is a shell builtin
echo is /bin/echo
[root@new55 ~]# type -a bulitin 
-bash: type: bulitin: not found
[root@new55 ~]# type -a builtin 
builtin is a shell builtin
[root@new55 ~]# type -a keyword 
-bash: type: keyword: not found
[root@new55 ~]# type -a command 
command is a shell builtin
[root@new55 ~]# type -a alias 
alias is a shell builtin
[root@new55 ~]# type -a grep 
grep is /bin/grep

linux常识:

在UNIX系统中,目录结构采用带链接树形目录结构

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

3分钟秒懂大数据

你的打赏就是对我最大的鼓励

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值