`

linux 日常操作 更新中...

阅读更多

1. 修改用户shell   需要root权限

chsh -s  /bin/csh username //username:用户名

2. 操作用户

useradd -g groupname -s /bin/csh -d /home/king -m king
passwd king
userdel -r king

3.数据库

sqlplus / as sysdba
startup  / shutdown /shutdown immediate
lsnrctl start /lsnrctl status
export ORACLE_SID=orcl

4. 文件

df -m //查看硬盘分区大小
du -m            //查看文件夹
du -sh *        //查看当前文件夹每个子文件夹大小
file xxx.so     //查看 32位,64位
free -h          //查看内存
fdisk -l          //查看硬盘
lsof               //查看动态链接库使用情况
ldd  -r            //查看动态链接库调用其他库的情况

5. 突破 grep的方法 (由于文件夹的文件数过多,出现不能gerp情况)

find . -name '*.unl' > allfile.txt
cat allfile.txt |xargs -n 10 grep '5845'

6. 批量在文件末尾追加内容

#!/bin/bash
for file in $(find . -name '*.unl')
do
    cat 1.txt >> $(file)  // 1.txt 预要添加的内容
done

 7. 查看内存和内容

top                                            //内存,进程  u:输入用户查看
mpstat 1                                    //每秒刷新cpu使用情况
vmstat  1                                       //每秒刷新内存增长情况
ls | more                                      //翻页
ls | less                                       //上翻 、下翻
chown -R  gname:uname *          //修改用户用户组
chmod 755 *                                //修改文件执行权限
find . -name '*.unl' -exec rm -rf {} \;  //查询删除操作
find . -name '*.log' -exec du -sh {} \;//查询统计文件大小
echo $shell | tee -a 1.txt               //带打印同时输出到文件效果

8. 共享内存

ipcs -mp          //查看共享内存
ipcs -m             //查看
ipcs -m shmid     //删除
 
分享到:
评论
12 楼 sblig 2012-09-26  
--oracle
导入
imp ICUB/ICUB@10.66.13.11/orcl file=D:\0827\ICUB.dmp log=c:\ICUB.log fromuser=ICUB touser=ICUB destroy=y ignore=y buffer = 20000000
导出
exp ICUB/ICUB@10.16.12.85/orcl file=c:\ICUB.dmp LOG=C:\ICUB.LOG owner=ICUB buffer=20000
11 楼 sblig 2012-09-26  

--oracle 存储过程不能调试 权限不够
GRANT debug any procedure, debug connect session TO 用户;
10 楼 sblig 2012-07-19  
连接数据库异常:ERROR 1130: Host '210.13.92.66' is not allowed to connect to this MySQL server

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'rootpasswd' WITH GRANT OPTION;

'%'换成'10.1.1.1'那么只有10.1.1.1的主机可以登陆.
9 楼 sblig 2012-07-19  
mysql:
启动: net start mysql
停止: net stop mysql
登陆: mysql -uxxx -p -h127.0.0.1
选择数据库: use db_name;

忘记密码:

Windows下的实际操作如下 
  1.关闭正在运行的MySQL。 
  2.打开DOS窗口,转到mysql\bin目录。 
  3.输入mysqld --skip-grant-tables回车。如果没有出现提示信息,那就对了。 
  4.再开一个DOS窗口(因为刚才那个DOS窗口已经不能动了),转到mysql\bin目录。 
  5.输入mysql回车,如果成功,将出现MySQL提示符 > 
  6. 连接权限数据库>use mysql; (>是本来就有的提示符,别忘了最后的分号) 
  6.改密码:> update user set password=password("123456") where user="root"; (别忘了最后的分号) 
  7.刷新权限(必须的步骤)>flush privileges; 
  8.退出 > \q 
8 楼 sblig 2012-05-03  
java 命令编译带包路径的如下
javac -d . xxx.java

执行的时候
java 包.xxx
7 楼 sblig 2012-05-03  
基于索引的SQL语句优化之降龙十八掌
http://cczakai.iteye.com/blog/963584
6 楼 sblig 2012-04-25  
1.//创建空间  

create tablespace test  
datafile 'c:\oracle\oradata\orcl9\test.dbf' size 50M  
default storage (initial 500K   
Next 500K  
minextents 1  
maxextents unlimited  
pctincrease 0); 

//Oracle创建用户权限
//创建用户  

create user lxg identified by lxg default tablespace test;  

//授权   

grant resource,connect,dba to test; 


//删除表空间   
drop tablespace "空间名" including contents and datafiles 

删除用户

drop user "lxg" cascade 增加表空间

alter tablespace chinawater add datafile 'c:\oracle\oradata\orcl9\ADDCHINAWATER.dbf' size 200M 创建用户

create user userName identified by password; 创建用户 userName,密码为 password


给用户授权


grant dba to lxg;--授予DBA权限  
grant unlimited tablespace to lxg;--授予不限制的表空间  


grant select any table to lxg;--授予查询任何表  

grant select any dictionary to lxg;--授予 查询 任何字典 

grant dba to lxg;  

grant unlimited tablespace to lxg;  

grant select any table to lxg;  

grant select any dictionary to lxg; 

5 楼 sblig 2012-04-19  
du  |awk '$1>200000'//找出大的文件夹

4 楼 sblig 2012-04-19  
ls 操作
l -t  //查看 按时间排序
l -lR //查看目录下所有文件结构
l -h  //查看文件的大小
3 楼 sblig 2012-04-19  
//重建分区上的索引
alter index PK_TRACELOG rebuild partition P201203 ; 
2 楼 sblig 2012-04-19  
jar cvf  a.jar a.class/*.*/*.class
1 楼 sblig 2012-04-19  
route                                        //查看路由
//若要添加带有 192.168.12.1 默认网关地址的默认路由,请键入: 
route add 0.0.0.0 mask 0.0.0.0 192.168.12.1   

//若要向带有 255.255.0.0 子网掩码和 10.27.0.1 下一跃点地址的 10.41.0.0 目标中添加一个路由,请键入: 
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 

//若要向带有 255.255.0.0 子网掩码和 10.27.0.1 下一跃点地址的 10.41.0.0 目标中添加一个永久路由,请键入: 
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1 

//若要向带有 255.255.0.0 子网掩码、10.27.0.1 下一跃点地址且其成本值标为 7 的 10.41.0.0 目标中添加一个路由,请键入: 
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7 

//若要向带有 255.255.0.0 子网掩码、10.27.0.1 下一跃点地址且使用 0x3 接口索引的 10.41.0.0 目标中添加一个路由,请键入: 
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3 

//若要删除到带有 255.255.0.0 子网掩码的 10.41.0.0 目标的路由,请键入: 
route delete 10.41.0.0 mask 255.255.0.0 

//若要删除以 10. 起始的 IP 路由表中的所有路由,请键入: 
route delete 10.* 

//若要将带有 10.41.0.0 目标和 255.255.0.0 子网掩码的下一跃点地址从 10.27.0.1 修改为 10.27.0.25,请键入: 
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25 

//使用  查看添加的路由 
netstat -rn

相关推荐

Global site tag (gtag.js) - Google Analytics