linux常用命令汇总1

xiaoxiao2021-02-28  134

置顶] linux常用命令汇总 2014-07-04 11:54 1871人阅读 评论(0) 收藏 举报  分类: LINUX基础学习(12)   版权声明:本文为博主原创文章,未经博主允许不得转载。 1. 文件及文件夹操作 1.1 修改文件名 mv abc ab 把文件名abc改为ab。 1.2 删除文件和文件夹 rm abc rm -rf abc 1.3 拷贝文件夹 格式: CP [选项]  源文件或目录   目的文件或目录 选项说明:-b 同名,备分原来的文件         -f 强制覆盖同名文件         -r  按递归方式保留原目录结构复制文件 cp -r /temp/a  /home/a 记得有空格 1.4 查看文件夹总大小 (1)查看当前文件夹总大小 进入文件夹下面,用du -s,或是du -sh查看,前者返回的是以MBytes为单位,后者返回的是GBytes为单位。 (2)产看指定文件夹大小 du -s /home,或是du -sh /home 1.5 剪切文件夹并重命名 rm /home/a  /temp/b 1.6 修改文件夹权限 chmod 777  /home/kandi 1.7 修改文件夹及其子目录下文件权限 chown -R root:root /home/kandi -R 处理指定目录以及其子目录下的所有文件,这条命令的意义是修改kandi文件夹及其子目录文件的拥有者和群组分别为root,第一个root为所有者。 1.8 删除不同目录下相同文件夹.Git find . -type d -name .git | xargs rm -rf 2.压缩和解压 2.1 压缩和解压tar.gz格式的文件 (1)压缩命令:   命令格式:tar  -zcvf   压缩文件名.tar.gz   被压缩文件名       可先切换到当前目录下。压缩文件名和被压缩文件名都可加入路径。 zip格式: zip -q -r des.zip src (2)解压缩命令:   命令格式:tar  -zxvf   压缩文件名.tar.gz   解压缩后的文件只能放在当前的目录。 zip格式:unzip -o -d src des.zip 3.查找 3.1 kernel目录下查找结构体dsi_cmd_desc定义 git grep -wn dsi_cmd_desc或是find ./ -iname *.c|xargs grep -wrn dsi_cmd_desc  3.2 kernel目录下找带有关键字的c文件  find ./kernel -iname *bat*.c  3.3在kernel\drivers\power下查找带有关键字power_supply_class_exit的文件和行显示出来 grep -wrn power_supply_class_exit 结果: power_supply_core.c:799:static void __exit power_supply_class_exit(void) power_supply_core.c:805:module_exit(power_supply_class_exit); 3.4在某些类型文件下查找指定字符串 4.VIM shift+q,退回到一般模式,然后q!可强制退出 5.查看文件类型 file 文件名 6.查看环境变量echo $name 7.Linux下将文件打包、压缩并分割成指定大小,点击打开链接 8.Android 惯用工作命令mmm,mm,m,croot,cgrep,jgrep,resgrep,godir,快速查找 find grep合并使用 Android 常用工作命令mmm,mm,m,croot,cgrep,jgrep,resgrep,godir 在大整个android 源代码的 Java,xml,mk里面查找内容快速命令 官方定义: Invoke “. build/envsetup.sh” from your shell to add the following functions to your environment: – croot: Changes directory to the top of the tree. – m: Makes from the top of the tree. – mm: Builds all of the modules in the current directory. – mmm: Builds all of the modules in the supplied directories. – mgrep: Greps on all local .mk files.  在目录下所有.mk文件里面查找内容 mgrep android_ap – cgrep: Greps on all local C/C++ files. – jgrep: Greps on all local Java files.   在目录下所有.java文件里面查找内容 jgrep android_ap – resgrep: Greps on all local res/*.xml files. – godir: Go to the directory containing a file. 即在已经下载好Android源码android目录下面执行:. build/envsetup.sh 或source build/envsetup.sh,即可开始使用上面命令
转载请注明原文地址: https://www.6miu.com/read-24178.html

最新回复(0)