6.~/.bash_logout:当每次退出系统(退出bash shell)时,执行该文件.
各种shell版本
Bourne Shell
C Shell
衍生:Korn, tcsh 及 bash
cat /etc/shells显示系统当前可用的shell
临时切换:直接打入shell名
下次登录切换:chsh(need reboot)
echo $0即显示当前所用shell的类型
echo $SHELL 显示系统默认的shell方法
bash -version 显示bash shell版本
$SHELL --version 通用方法
/dev/hda1 第一块硬盘的第一主分区
/dev/hdb5 第二块硬盘的第一逻辑分区
/dev/sda4 第一块SATA硬盘的第四(主分区或者扩展分区)
/dev/null 黑洞设备
chmod
权限 二进制 十进制
---------------------------------------
--- 000 0
--x 001 1
-w- 010 2
-wx 011 3
r-- 100 4
r-x 101 5
rw- 110 6
rwx 111 7
文件类型的表示符
---------------------------------------
d 目录
b 二进制特殊文件
c 文本特殊文件
l 符号连接
p Pipe
s Socket
- 普通文件
小结:常用的gdb命令
backtrace,bt 显示程序中的当前位置和表示如何到达当前位置的栈跟踪(同义词:where)
breakpoint 在程序中设置一个断点
cd 改变当前工作目录
clear 删除刚才停止处的断点
commands 命中断点时,列出将要执行的命令
continue 从断点开始继续执行
delete 删除一个断点或监测点;也可与其他命令一起使用
display 程序停止时显示变量和表达时
down 下移栈帧,使得另一个函数成为当前函数
frame 选择下一条continue命令的帧
info 显示与该程序有关的各种信息
help info
info address -- Describe where symbol SYM is stored
info all-registers -- List of all registers and their contents
info args -- Argument variables of current stack frame
info auxv -- Display the inferior's auxiliary vector
info breakpoints -- Status of user-settable breakpoints
info catch -- Exceptions that can be caught in the current stack frame
info classes -- All Objective-C classes
info common -- Print out the values contained in a Fortran COMMON block
info copying -- Conditions for redistributing copies of GDB
info dcache -- Print information on the dcache performance
info display -- Expressions to display when program stops
info extensions -- All filename extensions associated with a source language
info files -- Names of targets and files being debugged
info float -- Print the status of the floating point unit
info frame -- All about selected stack frame
info functions -- All function names
info handle -- What debugger does when program gets various signals
info line -- Core addresses of the code for a source line
info locals -- Local variables of current stack frame
info macro -- Show the definition of MACRO
info mem -- Memory region attributes
info program -- Execution status of the program
info registers -- List of integer registers and their contents
info scope -- List the variables local to a scope
info selectors -- All Objective-C selectors
info set -- Show all GDB settings
info signals -- What debugger does when program gets various signals
info source -- Information about the current source file
info sources -- Source files in the program
info stack -- Backtrace of the stack
info symbol -- Describe what symbol is at location ADDR
info target -- Names of targets and files being debugged
info terminal -- Print inferior's saved terminal status
info threads -- IDs of currently known threads
info tracepoints -- Status of tracepoints
info types -- All type names
info variables -- All global and static variable names
info vector -- Print the status of the vector unit
info warranty -- Various kinds of warranty you do not have
info watchpoints -- Synonym for ``info breakpoints''
jump 在源程序中的另一点开始运行
kill 异常终止在gdb 控制下运行的程序
list 列出相应于正在执行的程序的原文件内容
next 执行下一个源程序行,从而执行其整体中的一个函数
print 显示变量或表达式的值
pwd 显示当前工作目录
ptype 显示一个数据结构(如一个结构或C++类)的内容
quit 退出gdb
reverse-search 在源文件中反向搜索正规表达式
run 执行该程序
search 在源文件中搜索正规表达式
set variable 给变量赋值
signal 将一个信号发送到正在运行的进程
step 执行下一个源程序行,必要时进入下一个函数
undisplay display命令的反命令,不要显示表达式
until 结束当前循环
up 上移栈帧,使另一函数成为当前函数
watch 在程序中设置一个监测点(即数据断点)
whatis 显示变量或函数类型
/proc/1 关于进程1的信息目录。每个进程在/proc下有一个名为其进程号的目录
/proc/cpuinfo 处理器信息,如类型、制造商、型号和性能
/proc/devices 当前运行的核心配置的设备驱动的列表
/proc/dma 显示当前使用的DMA通道
/proc/filesystems 核心配置的文件系统
/proc/interrupts 显示使用的中断
/proc/ioports 当前使用的I/O端口
/proc/kcore 系统物理内存映像
/proc/kmsg 核心输出的消息,也被送到syslog
/proc/ksyms 核心符号表
/proc/loadavg 系统的平均负载
/proc/meminfo 存储器使用信息,包括物理内存和swap
/proc/modules 当前加载了哪些核心模块
/proc/net 网络协议状态信息
/proc/stat 系统的不同状态
/proc/version 核心版本
/proc/uptime 系统启动的时间长度
修改HOSTNAME
修改/etc/sysconfig/network 然后reboot
系统信息查询
cat /proc/cpuinfo
cat /proc/meminfo
lspci |grep VGA
uname -a
cat /etc/issue=lsb_release -a 查distributor
同步时间
ntpdate cn.pool.ntp.org
查看CMOS时间,hwclock -r
写入, hwclock -w
vi /etc/sysconfig/clock #编辑时间配置文件
UTC=true 与bios一致
IP配置
文件/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
HWADDR="FC:4D:D4:37:A1:90"
NM_CONTROLLED="yes"
ONBOOT="yes"
NETMASK="255.255.0.0"
IPADDR="172.16.201.32"
GATEWAY="172.16.0.1"
BOOTPROTO="static"
TYPE="Ethernet"
DNS1=159.226.128.1
DNS1=159.226.128.8
文件/etc/sysconfig/network 一般也不需要修改
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=localhost.localdomain
/etc/resolv.conf文件,DNS,这个文件不需要修改,它根据网卡的配置文件/etc/sysconfig/network-scripts/ifcfg-eth0自动产生
service network restrat
ifconfig eth0 192.168.56.102 临时修改
删除多余网卡
udev记录网络规则的脚本为:/etc/udev/rules.d/70-persistent-net.rules
tree目录结构
\cmd 就是在 shell 裡所輸入的 cmd 不會替換為 alia
md5sum
sha1sum
管道是实现“将前面的标准输出作为后面的标准输入”
xargs是实现“将标准输入作为命令的参数”
echo "--help"|cat
echo "--help"|xargs cat