linux
来源:互联网 发布:淘宝关键词搜索排名 编辑:程序博客网 时间:2024/06/05 15:06
mount 挂在
umount 卸载
alias 命令别名
df 查挂载和空间使用
df -T 查看挂载,空间和文件系统
ll 查看软连接
!vi 历史中最近以vi开头的命令
/var 日志目录
/bin 所有用户都可以执行的程序
/sbin root用户可执行的程序
/etc 配置文件
/usr 安装程序
more 跟多
ctrl+u 快速回城
tab 补全
查看文件
head
tail
查找命令
which
find
locate 先要执行updatedb
递归创建目录
mkdir -p
tree dir 递归查看目录
增加用户
useradd 用户名
改密码
passwd 用户名
删除用户
userdel -r 用户名
查看用户
id 用户名
cat /etc/passwd | grep 用户名
压缩.gz
tar czf a.gz 1.file 2.file
解压gz
tar xzf a.gz [-C /tmp/]
查看
tar tf file.zf
压缩zip
zip file.zip a.txt b.txt
查看压缩包
unzip -l file.zip
解压压缩包
unzip file.zip
临时设置ip
ifconfig ech0 192.168.192.1
防火墙
一.iptables
1.查看防火墙
iptables -L -n
2.清空iptablesfang防火墙
iptables -F
3.保存防火墙
service iptables save
二.selinux
1.查看
sestatus
2.关闭selinux防火墙
vi /etc/selinux/config
SELINUX=disabled
帮助
ls --help
zip -h
man ls
只有rpm安装的服务脚本(/etc/rc.d/init.d),才能通过chkconfig调启动级别和service来控制关闭和启动,
chkconfig调启动级别
chkconfig --level 3 httpd on
service 控制和关闭
service 进程 start
runlevel查看运行级别
init 0 关机
init 6 重庆
1.查看时间:
date [+%Y-%m-%d %H:%M:%S]
2.修改时间:
date -s "2014/1/3"
3.查看主机名:hostname
修改主机名
1.临时修改:hostname host
2.永久修改:vi /etc/syscofig/network HOSTNAME
设置光驱自动挂载
vi /etc/fstab
/dev/cdrom /media iso9660 auto,ro 0 0
测试fstab中光驱挂载是否成功
mount -a
查看分区
fdisk -l
pc
硬盘分区
1.从sdb上分3G分区
fdisk /dev/sdb
按n建立分区
按p建立第一个主分区
按t键修改文件系统
w保存
2.格式成ext3文件系统:mkfs.etx3 /dev/sdb1
3.挂载/mnt下使用 mount /dev/sdb1 /mnt
查看挂载:df
软件包安装-yum
1.准备yum源(软件仓库)
2.修改yum配置文件
查看
yum list |grep http
安装软件
yum -y install httpd*
卸载
yum remove httpd*
yum search ifconfig
查看安装的软件
rpm -qa
卸载安装的软件 --nodeps 截断依赖
rpm -e mysql-5.0 --nodeps
权限
所有者(u) 组内(g) 其他组(o) 所有(a)eg:a=u+g+o
chmod o-x,g+w file
目录的rwx: r:查看文件 w:写入和删除文件 x:切入目录
文件的rwx r:查看内容 w:写入权限 x:执行权限
把game加入root组
gpasswd -a game root
把game从root组中删除
gpasswd -d game root
sudo授权
visudo
game localhost = /sbin/useradd, /sbin/userdel
sudo /sbin/useradd test
ACL权限分配
1.添加权限
setfacl -m u:game:rw dir
递归修改文件夹权限 setfacl -m u:game:rw -R dir
2.删除权限
setfacl -x u:game dir
setfacl -x -b dir
3.查看权限
getfacl dir
服务进程:
1.查看进程
ps -ef | grep httpd
pstree -p | grep httpd
2.查看端口
netstat -tunpl | grep 8000
3.关闭进程
pkill httpd
kill -9 pid
查看服务器性能
top //3秒刷新一次
uptime//平均负载
last//查看服务器重要操作
who //同时在线用户
任务计划- crontab
* * * * 分 时 日 月 周
00 30 * * * 每天3点
30 23 * * * 每天23:00
*/5 * * * * 每隔5分钟
59 23 * * 1-5 周一至周五23:59
59 23 * * 1,3,5 周一, 周三, 周五23:59
创建任务计划
crontab -e
查看计划任务
crontab -l
删除所有任务计划
crontab -r
开机启动
/etc/rc.d/rc.local
&>/dev/null:垃圾站
开启apache
apachectl start
apache服务权限
<Directory />
AllowOverride All
Order allow,deny
Allow from all
</Directory>
服务器文件权限
indexes 先查看默认首页,如果不存在就以文件列表显示
FollowSymlinks 网站目录下允许存在快捷方式
MultViews 多视图,访问/index 等于/index.html
虚拟目录:
http://localhost/mnt mnt不在网站根目录下面,这个时候可以做虚拟目录
eg:(别名)
Alias /mnt "/mnt"
<Directory "/mnt">
AllowOverride All
Order allow,deny
Allow from all
</Directory>
做了虚拟主机,原来的网站根目录都无效
0 0
- linux
- linux
- Linux
- Linux
- LINUX!
- Linux
- linux
- linux
- linux
- Linux
- linux
- linux
- linux
- linux
- Linux
- linux
- linux
- Linux
- 如何在Windows中后台运行命令行程序
- Web开发模式
- 07-CSS 行高和字号 超级链接的美化 background系列属性
- 判空方法
- B+树&B*树简介
- linux
- 菜鸟学习HTML之前的一点心得
- Vim 分屏 + 复制系统粘贴板
- HDFS、YARN和MapReduce简介
- Java中的HashSet
- hadoop2.5.2 启动成功后,用jps查看节点:发现少了DataNode
- 单例模式
- UML学习归纳整理
- 汇编语言编程中应当注意的几大规范