Linux/Unix: Rename Directory With Spaces In Name

To rename a directory with spaces in its name in Linux or Unix, you need to use quotes or escape the spaces. Here are two ways to do this:

  1. Use quotes:
mv "old directory name" "new directory name"
  1. Escape the spaces:
mv old\ directory\ name new\ directory\ name

Note: Make sure to replace “old directory name” and “new directory name” with the actual names of your directories. Also, be careful when renaming directories, as renaming a directory can have unintended consequences, such as breaking links or affecting other applications. It is always a good idea to backup important data before making any changes.

Leave a Comment