linux学习笔记之开始
2014-12-07 14:35
363 查看
贪多嚼不烂
redhat fedora 6.0出名 --> 8.0 -->9.0
suse 诞生于德国 界面华丽 对中文支持好 pc占有率高 企业版好像性能高于redhat novell收购 貌似想卖给VMWare
debian
slackware 开发者最喜欢 自由度大
gentoo near slackware 骨灰级 源码安装 接近硬件 电驴就用这款
LFS ------>自己安装 最纯净的 自己编译
GNU
GPL病毒式传播。 完全公布源码。必须开源。。不准商业化。
FSF
The freedom to run the program for any purpose
The freedom to study and modify the source code
The freedom to redistribute the program
The freedom to create directive programs
promot提示符
$ #
虚拟终端 tty1---6 ctrl alt F1--6
启动图形界面 startx
用户 普通用户 特权用户
su switch user
su username 只切换身份
su -username 安全切换 切换环境变量
id username 查看用户信息
Shell
bash 再次研发 b again sh
sh 最古老
tsh
csh
bash history tab(命令补全 路径补全) 管道 热键自定义 编程
shell自身带在命令 内部命令
外部命令 在某个目录下存在的可执行文件。
内部命令 如cd
type cmd 判断命令是否为内部命令
一切皆文件 99.9%均是文件
linux带有体积小且功能单一的小程序 组合小程序完成大任务
尽可能避免捕获用户接口。
使用纯文本文件保存配置信息。
!!重复最近一次执行过在命令。
!+string 执行最近在以该字符串开头在命令。
!-3 倒数第3个。
Alt + . || Esc + . || !$ 最近一次执行的命令的最后一个参数。
history -c clear 清除历史记录。
nano
目录是构成现代操作系统的基本元素。
目录只是一个映射文件 通过目录可以找到相应的文件。
ls -ld 查看目录信息。
ls -lh 查看文件大小。
cd 回到家目录 cd ~
文件
访问时间
修改时间 内容
改变时间 属性 内容 等
stat filename
touch filename 修改文件时间属性 或创建新文件
touch -a -m
cp默认不复制目录
shell
ctrl + a 移动光标到行首
ctrl + e 回到原来位置
ctrl + u 删除光标到行首的内容
ctrl + k 删除光标到行尾的 内容
ctrl + arrow左右箭头 一次跳一个单词 桌面可用
命令行展开。
匹配
正则 [:lower:] [:upper:] [[:digit:]] [[:alpha:]] [[:punct:]]特殊字符
mkdir x/{y,z} x/{y,z}/a1 -p x/y/a1 x/z/a1
mkdir -v {x,m}_{y,z}
$()
`命令引用。
touch myfile`date +%F-%H-%M-%S`
touch a*b 若有a*b文件则修改其时间 touch "a*b"
\避免展开 转义
grep正则
^行首
$行尾
.任意单个字符
*其前面的字符零次一次或多次
x\{m,n\} x出现次数在m和n之间。 可以缺少m或者n之一。
\.在匹配ip地址最有用
\<词首锚定符 grep "\<bin" shells
\>词尾锚定符 grep "\<bin\>" shells
\(\) 后向引用()内部的字符。
ab
aab
acb
b
love his lover
like his liker
grep --color "love.*lover" text.txt
grep --color "l..e.*l..er" text.txt
grep --color "\(l..e\).*\1r" text.txt \1引用第一组括号的内容
grep --color "bash$" /etc/passwd
root:x:0:0:root:/root:/bin/bash
lijinya:x:500:500:centos:/home/lijinya:/bin/bash
centos:x:501:501::/home/centos:/bin/bash
mysql:x:502:502::/home/mysql:/bin/bash
[lijinya@localhost tmp]$ grep --color "^root" /etc/passwd
root:x:0:0:root:/root:/bin/bash
roota:x:503:503::/home/roota:/bin/bash
[lijinya@localhost tmp]$ grep --color "^root\>" /etc/passwd
root:x:0:0:root:/root:/bin/bash
正则表达式
基本
扩展
redhat fedora 6.0出名 --> 8.0 -->9.0
suse 诞生于德国 界面华丽 对中文支持好 pc占有率高 企业版好像性能高于redhat novell收购 貌似想卖给VMWare
debian
slackware 开发者最喜欢 自由度大
gentoo near slackware 骨灰级 源码安装 接近硬件 电驴就用这款
LFS ------>自己安装 最纯净的 自己编译
GNU
GPL病毒式传播。 完全公布源码。必须开源。。不准商业化。
FSF
The freedom to run the program for any purpose
The freedom to study and modify the source code
The freedom to redistribute the program
The freedom to create directive programs
promot提示符
$ #
虚拟终端 tty1---6 ctrl alt F1--6
启动图形界面 startx
用户 普通用户 特权用户
su switch user
su username 只切换身份
su -username 安全切换 切换环境变量
id username 查看用户信息
Shell
bash 再次研发 b again sh
sh 最古老
tsh
csh
bash history tab(命令补全 路径补全) 管道 热键自定义 编程
shell自身带在命令 内部命令
外部命令 在某个目录下存在的可执行文件。
内部命令 如cd
type cmd 判断命令是否为内部命令
一切皆文件 99.9%均是文件
linux带有体积小且功能单一的小程序 组合小程序完成大任务
尽可能避免捕获用户接口。
使用纯文本文件保存配置信息。
!!重复最近一次执行过在命令。
!+string 执行最近在以该字符串开头在命令。
!-3 倒数第3个。
Alt + . || Esc + . || !$ 最近一次执行的命令的最后一个参数。
history -c clear 清除历史记录。
nano
目录是构成现代操作系统的基本元素。
目录只是一个映射文件 通过目录可以找到相应的文件。
ls -ld 查看目录信息。
ls -lh 查看文件大小。
cd 回到家目录 cd ~
文件
访问时间
修改时间 内容
改变时间 属性 内容 等
stat filename
touch filename 修改文件时间属性 或创建新文件
touch -a -m
cp默认不复制目录
shell
ctrl + a 移动光标到行首
ctrl + e 回到原来位置
ctrl + u 删除光标到行首的内容
ctrl + k 删除光标到行尾的 内容
ctrl + arrow左右箭头 一次跳一个单词 桌面可用
命令行展开。
匹配
正则 [:lower:] [:upper:] [[:digit:]] [[:alpha:]] [[:punct:]]特殊字符
mkdir x/{y,z} x/{y,z}/a1 -p x/y/a1 x/z/a1
mkdir -v {x,m}_{y,z}
$()
`命令引用。
touch myfile`date +%F-%H-%M-%S`
touch a*b 若有a*b文件则修改其时间 touch "a*b"
\避免展开 转义
grep正则
^行首
$行尾
.任意单个字符
*其前面的字符零次一次或多次
x\{m,n\} x出现次数在m和n之间。 可以缺少m或者n之一。
\.在匹配ip地址最有用
\<词首锚定符 grep "\<bin" shells
\>词尾锚定符 grep "\<bin\>" shells
\(\) 后向引用()内部的字符。
ab
aab
acb
b
love his lover
like his liker
grep --color "love.*lover" text.txt
grep --color "l..e.*l..er" text.txt
grep --color "\(l..e\).*\1r" text.txt \1引用第一组括号的内容
grep --color "bash$" /etc/passwd
root:x:0:0:root:/root:/bin/bash
lijinya:x:500:500:centos:/home/lijinya:/bin/bash
centos:x:501:501::/home/centos:/bin/bash
mysql:x:502:502::/home/mysql:/bin/bash
[lijinya@localhost tmp]$ grep --color "^root" /etc/passwd
root:x:0:0:root:/root:/bin/bash
roota:x:503:503::/home/roota:/bin/bash
[lijinya@localhost tmp]$ grep --color "^root\>" /etc/passwd
root:x:0:0:root:/root:/bin/bash
正则表达式
基本
扩展
相关文章推荐
- LINUX C 学习笔记-2-从环境变量开始-高级篇
- 从今天开始撰写动态版的Linux学习笔记
- 开始上传LINUX学习的笔记。
- 开始学习编写linux2.6.15的模块
- 开始学习Linux
- 学习嵌入式Linux系统的笔记和体会
- linux学习笔记(1)
- 今天开始在这里写学习Python、应用Python的学习笔记
- Win32学习笔记 第一章 开始
- 学习嵌入式Linux系统的笔记和体会
- 开始学习Linux
- Linux学习笔记-shell命令[转帖]
- 今天开始重新整理我的RUP学习笔记
- linux学习笔记
- linux 学习笔记(系统管理篇#已整理完#)
- 我刚开始学习VSTF时的笔记
- LINUX学习笔记—SAMBA使用篇 smb 文件共享
- Linux学习笔记-与系统管理有关的命令[转帖]
- Linux学习笔记之后台进程(at和&)
- [学习笔记]开始学directx了之一