Skip to content

Instantly share code, notes, and snippets.

@kshitij10496
Created May 9, 2017 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kshitij10496/74ec0beed9c6239e0738d22a56c24323 to your computer and use it in GitHub Desktop.
Save kshitij10496/74ec0beed9c6239e0738d22a56c24323 to your computer and use it in GitHub Desktop.
Shell Tips and Tricks
  1. Creating new directories
  • mkdir <path> : Creates a new directory on the specified file path if such a path exists.
  • mkdir -p <path> : Creates intermediate directories necessary for creating the desired directory. Discovered while setting Go Workspace and Namespace.

Usage

$ mkdir $HOME/foo/bar # foo does not exist
mkdir: foo: No such file or directory

$ mkdir -p $HOME/foo/bar # both foo and bar directories are created

Usecase: Can create temporary directories

  1. Removing Directories

    a. Deleting empty directories - 'rmdir path/to/target/directory'

    b. Deleting any directory along with the files inside it - 'rm -r path/to/taget/directory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment