zoukankan      html  css  js  c++  java
  • [Bash] Operations against Folder

    Open folder

    When you want to open a folder in Finder, for example your current folder:

    open .
    open .git ## you can open the hidden folder
    

    Create folder

    Create a single folder

    mkdir folder
    

    You can also create nested folders

    mdkir -p a/b/c
    

    It will create a folder c inside folder b inside folder a.

    Remove folder

    Note that the rm command permanently deletes a file. It doesn't move it to the trash or anything. If we want to remove a folder, we can't just use plain rm.

    rm by default only removes files. If we pass the -rflag that will tell it to recursively remove the folder and everything in it.

    Oftentimes, you'll see rm used with the -r flag and the -f flag. The -f flag is a sort of a nuclear option. It prevents Bash from prompting you for confirmation when you remove a file, as well as erroring out if a file or directory doesn't exist. If we do that on a, that will remove that folder and all of its contents, as well.

    rm folder/
    rm -r folder/
    rm -rf a/
    

    Rename a folder

    Rename src folder to lib folder

    mv src/ lib
    

    Find folders

    Find all folders under current dir:

    find . -type d
    

    The same as ls -G.

    Find all folders under current dir which named "images":

    find . -type d -name "images"
    
  • 相关阅读:
    windows7 端口查看以及杀死进程释放端口
    字符设备驱动模块与测试代码编写。
    c++项目范例
    较复杂makefile跟lds脚本程序的编写
    S5PV210时钟,看门狗定时器
    S5PV210中断处理
    arm 异常处理结构
    arm指令系统
    arm体系结构
    s5pv210 的启动
  • 原文地址:https://www.cnblogs.com/Answer1215/p/14390851.html
Copyright © 2011-2022 走看看