Here are some common directory commands in Bash:
-
ls: Lists files and directories in the current directory.- Example:
ls -la(lists all files with details).
- Example:
-
cd: Changes the current directory.- Example:
cd /path/to/directory(navigates to the specified directory).
- Example:
-
mkdir: Creates a new directory.- Example:
mkdir new-directory(creates a directory named "new-directory").
- Example:
-
rmdir: Removes an empty directory.- Example:
rmdir empty-directory(removes the specified empty directory).
- Example:
-
rm -r: Removes a directory and its contents recursively.- Example:
rm -rf directory-name(removes the directory and all its files).
- Example:
-
pwd: Prints the current working directory (as previously explained). -
cp: Copies files or directories.- Example:
cp -r source-directory destination-directory(copies the source directory to the destination).
- Example:
-
mv: Moves or renames files or directories.- Example:
mv old-directory new-directory(renames or moves the directory).
- Example:
These commands are essential for navigating and managing directories in a Linux environment. If you need more information on any specific command, let me know!
