Linux入门笔记五
Shell脚本及其成分
Shell是一个功能强大的编程语言。用Shell编写的批处理文件称为Shell脚本、
Shell脚本的成分
-注释部分
以#开头的行
-命令
在Shell脚本中可以出现任何在交互方式下可以使用的命令
-变量
既可以使用用户自定义的变量,也可以使用系统环境变量
-流程控制
对命令的执行流程进行控制(顺序、分支、循环)
练习
more /etc/httpd/
vi hello
ls
date
whoami
pwd
date;whoami;pwd
在hello里写上
#/bin/bash
#this script is display current user,time and path
#it is display current time
echo "current time is"
date
#it is display current user
echo "current user is"
whoami
#it is display current path
echo "current path is"
pwd
执行bash hello
练习
ls -l
-rwxr-xr-- Root IT abctxt
Root 作为所有者 看前三项 rwx
执行chmod u+x hello
ls -l hello
IT 作为所有组 看中间三项 r-x
其他所有组 看后三项 r--
常见的环境变量
HOME 用户主目录
PATH 命令搜索路径
PS1 命令提示符号
PWD 用户当前工作路径
SHELL 用户shell类型
TERM 终端类型
LANG 语言环境
x=abc
echo x
echo $x
x=asdfsaf
echo $x
echo $SHELL
echo $PATH
修改环境变量
PATH=$PATH:/root
echo $hello
相关文档:
#include <fcntl.h>
int main(void)
{
typedef union un{
short s;
char c[sizeof(short)];
}un;
un myun;
myun.s = 0x0102;
......
(一)RedHat/CentOS/Fedora 系统密码破解
1.在grub选项菜单按E进入编辑模式。
2.编辑kernel 那行最后加上S(或者Single)。
3.按B,启动到single-user mode。
4.进入后执行下列命令:
# mount -t proc proc /proc
# mount -o remount,rw /
#passwd
#sync
#reboot
(二)D ......
下载SmartFoxServerPro,地址:http://www.smartfoxserver.com/products/pro.php
解压:
gzip -d filename.tar.gz
tar xf filename.tar
进入解压后的文件夹,执行安装:
./install
安装过程中要输入安装路径。
安装完成后,进入安装目录下的Server文件夹,执行./sfs start开启服务器。
命令:
./sfs start &n ......
/ 根目录
/bin 常用的命令 binary file 的目录
/boot 存放系统启动时必须读取的档案,包括核心 (kernel) 在内
  ......
./configure 检查系统信息
./configure --help | more 帮助信息
make clean   ......