您的位置:首页 > 运维架构 > Linux

常用linux命令

2016-04-13 20:10 489 查看
1. mkdir -p:创建多级目录  eg: mkdir -p  A/B

2. 复制: ctrl+insert 粘贴:shift+insert

3. vi编辑时--》撤销:esc-->u    撤销本次编辑时被撤销的内容:ctrl+R

4. 反引号` `的作用《==》$(),都是执行夹在里面的命令

5. 修改文件的权限:chmod -R 744 *

    修改当前目录下所有的子目录、文件的权限:当前用户rwx   组用户:r   其他用户:r

6. 调试shell脚本:shell -x

7. 替换文件中匹配的字符串:sed -i 's/原字符串/替换字符串/g' filename //替换文件中的所有匹配项

8. 字符串切换编码:iconv -c -f gbk -t utf8 feed_test_data.txt>feed_test_data.txt_utf8

9.  查找:

   find /disk9/cmsdata/file_product -name '*.csv' -type f -newermt "${yesterdaystr}" ! -newermt "${todaystr}" | xargs -i cp -vr {} $rawpath'/' | tee copy.log

  find -newermt

  man find的解释::

-newerXY reference

              Compares the timestamp of the current file with reference.   The

              reference  argument  is  normally the name of a file (and one of

              its timestamps is used for the comparison) but it may also be  a

              string  describing  an  absolute time.  X and Y are placeholders

              for other letters, and these letters select which time belonging

              to how reference is used for the comparison.

              a   The access time of the file reference

              B   The birth time of the file reference

              c   The inode status change time of reference

              m   The modification time of the file reference

              t   reference is interpreted directly as a time

              Some  combinations are invalid; for example, it is invalid for X

              to be t.  Some combinations are not implemented on all  systems;

              for example B is not supported on all systems.  If an invalid or

              unsupported combination  of  XY  is  specified,  a  fatal  error

              results.   Time  specifications are interpreted as for the argu-

              ment to the -d option of GNU date.  If you try to use the  birth

              time  of  a  reference file, and the birth time cannot be deter-

              mined, a fatal error message results.  If  you  specify  a  test

              which  refers  to  the  birth time of files being examined, this

              test will fail for any files where the birth time is unknown.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: