linux之shell基础

Linux系统能够同时接受多个用户登陆,还容许用户在同一时间进行屡次登陆,由于Linux系统提供了虚拟控制台的访问方式。 RHEL的虚拟终端默认有6个,其中从第2个到第6个虚拟终端老是字符界面,而第1个虚拟终端默认是图形化用户界面linux

shell的分类shell

name intro
C shell 用来交互
Bourne shell 用来编程
Korn shell 结合了C shell的交互式特性,融入Bourneshell的语法,并增添了不少新功能
Bourne Again Shell(bash) GNU计划的一部分,用来替代Bourne shell,用于基于GNU的系统.

大多数的Linux(Red Hat, Slackware, Caldera)都以bash做为缺省的shell,编程

从字符界面的虚拟终端切换到图形化用户界面bash

Ctrl+Alt+F1
复制代码

从图形化用户界面切换到字符界面的虚拟终端ui

Ctrl+Alt+F2~F6
复制代码

注销:在shell窗口键入exit命令或ctrl+Dspa

重启命令行

$ reboot
$ shutdown –r now
复制代码

关机unix

user@computer: ~$ halt
user@computer: ~$ shutdown –h now
复制代码

命令行经常使用辅助操做code

操做 intro
tab 自动补齐
\ 强制换行
Ctrl+U 清空至行首
Ctrl+K 清空至行尾
Ctrl+L 清屏
Ctrl+C 取消本次命令编辑
Home 跳到行首
End 跳到行尾
上方向键 上一条历史记录
下方向键 下一条历史记录

经常使用通配符继承

符号 intro
? 匹配任意一个字符
* 匹配任意多个字符
[] 至关于或的意思
- 表明一个范围,好比a-z
user@computer: ~$ ls /etc/b* 
user@computer: ~$ ls /bin/l?
user@computer: ~$ ls [a-z0-9]*
复制代码

help查看Bash内部命令的帮助信息

user@computer: ~$ help
job_spec [&]               history [-c] [-d offset] [n] or history -anrw 
...
复制代码

[command] --help 查看某条命令的帮助信息

user@computer: ~$ pwd --help
pwd: pwd [-LP]
    Print the name of the current working directory.
...
复制代码

man 阅读手册页

上下方向键滚动文本
使用`Page Up`和`Page Down`键翻页 
`Q`或`q`退出阅读环境
输入`/`后查找内容
复制代码
user@computer: ~$ man pwd
NAME                                                 
   pwd - print name of current/working directory 
SYNOPSIS                                             
   pwd [OPTION]...
...
复制代码

man –k [keywords] 查找与keywords有关的命令

user@computer: ~$ man -k pwd
pwd (1)              - print name of current/working directory
pwdx (1)             - report current working directory of a process
unix_chkpwd (8)      - Helper binary that verifies the password of the current user
复制代码

linux的目录结构

Linux文件系统继承了UNIX的特色,它采用了树型目录结构,经过目录将系统中全部的文件分级、分层的组织在一块儿,以根目录为起点,全部目录都从根目录里派生而来, 把设备视为文件,设备与文件使用统一的接口进行处理 树型结构的最上层是根目录,用表示 系统在运行中能够经过使用命令或系统调用进入任何一层目录

$ tree -L 1 -d /
/         
├── bin   
├── boot  
├── dev   
├── etc   
├── home  
├── lib   
├── lib64 
├── media 
├── mnt   
├── opt   
├── proc  
├── root  
├── run   
├── sbin  
├── snap  
├── srv   
├── sys   
├── tmp   
├── usr   
└── var   
复制代码
相关文章
相关标签/搜索