工作常用的命令积累

来源:互联网 发布:falcon猎鹰手表知乎 编辑:程序博客网 时间:2024/05/19 05:01
工作常用的命令积累

0. 找出 =与& 之间的字符串 并输出
      
awk '{print $3}'
     (1) awk -F"[=|&]" '{print $2}' file1 > file2
     (2) awk -F"[:|\n]" '{print $2}' file1 > file2
         awk -F"[\^|\^]" '{print $2}' file1 > file2
     (3) sed '/\^/d' 试试

awk -F"[crowd_list":|"attachment"]" '{print $2}' file1 > file2

1. shell 中 cut 命令的用法
echo root:x:0:0:root:/root:/bin/bash | cut -d : -f 6-7

1. 如何查看一个目录占用的空间
     (1)  cd target_dir
     (2)  du -sh

2. 常用的命令
    nohup sh create_redis.sh > create_redis.log 2>&1 & 

3. 查找目录下的所有文件中是否含有某个字符串 
     find .|xargs grep -ri "IBM" 
   查找目录下的所有文件中是否含有某个字符串,并且只打印出文件名 
     find .|xargs grep -ri "IBM" -l 

4. 让一个变量具有双引号 : '"${plat}:$version_init"'

2. svn 与 git 相关
    (1) 如 :  git clone http://****/dm/dmp_engine.git (注意这个地址是 HTTP 不是 SSH)    
              cd dmp_engine
              git branch -r
              git checkout 分支名,这是重新 down 分支的步骤

       git add filename
       git commit -m “a"
       git push origin 分支名 或者
       git push -u origin origin/dev_dmp_online_serving
       git checkout branch_name 切换到这个分支之下
      
   (2). 从 master 拉下 新分支, 新分支名叫 online_redis3.0
       1). git checkout -b online_redis3.0 master
       2). 

    (1) svn co target_dir
    (2) svn add target_file
    (3) svn ci -m "" 
    (4) svn update
    (5) svn del / rm
    (6) svn status
    注意 : 不要在 svn 控制下,使用 rm 操作。 应该使用 " svn rm "

svn reviewboard :
在本地svn控制下的文件 : svn diff file/dname > name.diff

填写review 的过程
1, 填写项目名称
2, 填写 base,到你diff目标的上一级
3, 上传diff文件

选择people成员,邮箱前缀,逗号分隔
填写简介 与 测试案例

之后确认后,选择 public,success。完毕

---------批量替换字符串--------
sed -i "s/oldString/newString/g"  `grep oldString -rl ./`


3. 查看 内存 与 CPU 信息

查看内存 : cat /proc/meminfo

1. 查看物理CPU的个数
#cat /proc/cpuinfo |grep "physical id"|sort |uniq|wc -l
 
2. 查看逻辑CPU的个数
#cat /proc/cpuinfo |grep "processor"|wc -l
 
3. 查看CPU是几核
#cat /proc/cpuinfo |grep "cores"|uniq
 
4. 查看CPU的主频
#cat /proc/cpuinfo |grep MHz|uniq


top 之后按 C

4. hive 积累
(1) hive -e "select attributes['lt_its'],attributes['ad_clicks'] from new_algo_user_attributes where dt='20150419' and platform='pc' and attributes['lt_its']<>'NULL' limit 10"
0 0
原创粉丝点击