这个方法很笨拙,首先列出目录下所有子目录,然后在列出每个子目录的文件,而不能列出子目录里面的目录的文件,实际上只是列出子目录的文件和目录。求更简单的!
1 2 3 4 | for FILE in $(ls -l | awk '/^d/{print $NF}'); do ls -1 $FILE; done |
这个方法很笨拙,首先列出目录下所有子目录,然后在列出每个子目录的文件,而不能列出子目录里面的目录的文件,实际上只是列出子目录的文件和目录。求更简单的!
1 2 3 4 | for FILE in $(ls -l | awk '/^d/{print $NF}'); do ls -1 $FILE; done |
1 2 3 | ls -l |grep '^d'</code> ls -l | awk '/^d/{print $NF}' ls -F | grep / |
显示所有用户的Crontabs任务语句
1 | for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done |
输入表名,生成插入语句
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | drop proc proc_insert go create proc proc_insert (@tablename varchar(256)) as begin set nocount on declare @sqlstr varchar(4000) declare @sqlstr1 varchar(4000) declare @sqlstr2 varchar(4000) select @sqlstr='select ''insert '+@tablename select @sqlstr1='' select @sqlstr2=' (' select @sqlstr1= ' values ( ''+' select @sqlstr1=@sqlstr1+col+'+'',''+' ,@sqlstr2=@sqlstr2+name +',' from (select case -- when a.xtype =173 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end' when a.xtype =127 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(20),'+a.name +')'+' end' when a.xtype =104 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(1),'+a.name +')'+' end' when a.xtype =175 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end' when a.xtype =61 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end' when a.xtype =106 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end' when a.xtype =62 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end' when a.xtype =56 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(11),'+a.name +')'+' end' when a.xtype =60 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end' when a.xtype =239 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end' when a.xtype =108 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.xprec+2)+'),'+a.name +')'+' end' when a.xtype =231 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end' when a.xtype =59 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(23),'+a.name +',2)'+' end' when a.xtype =58 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'convert(varchar(23),'+a.name +',121)'+ '+'''''''''+' end' when a.xtype =52 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(12),'+a.name +')'+' end' when a.xtype =122 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(22),'+a.name +')'+' end' when a.xtype =48 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar(6),'+a.name +')'+' end' -- when a.xtype =165 then 'case when '+a.name+' is null then ''NULL'' else '+'convert(varchar('+convert(varchar(4),a.length*2+2)+'),'+a.name +')'+' end' when a.xtype =167 then 'case when '+a.name+' is null then ''NULL'' else '+'''''''''+'+'replace('+a.name+','''''''','''''''''''')' + '+'''''''''+' end' else '''NULL''' end as col,a.colid,a.name from syscolumns a where a.id = object_id(@tablename) and a.xtype <>189 and a.xtype <>34 and a.xtype <>35 and a.xtype <>36 )t order by colid select @sqlstr=@sqlstr+left(@sqlstr2,len(@sqlstr2)-1)+') '+left(@sqlstr1,len(@sqlstr1)-3)+')'' from '+@tablename -- print @sqlstr exec( @sqlstr) set nocount off end go |
刚刚在64位的centos系统安装Google perftools时,出现下面错误
error Cannot calculate stack trace: need either libunwind or frame-pointers
解决方法是在编译参数里增加 --enable-frame-pointers
操作如下,登陆SSH:
1 | vi /etc/sysconfig/network-scripts/ifcfg-eth0:0 |
第二个IP,就是
1 | vi /etc/sysconfig/network-scripts/ifcfg-eth0:1 |
第三个IP,就是
ifcfg-eth0:2(由此类推)
(more…)