What are other directory commands?

QuestionsQuestions8 SkillsProBasic Files OperationsNov, 07 2025
064

Here are some common directory commands in Bash:

  1. ls: Lists files and directories in the current directory.

    • Example: ls -la (lists all files with details).
  2. cd: Changes the current directory.

    • Example: cd /path/to/directory (navigates to the specified directory).
  3. mkdir: Creates a new directory.

    • Example: mkdir new-directory (creates a directory named "new-directory").
  4. rmdir: Removes an empty directory.

    • Example: rmdir empty-directory (removes the specified empty directory).
  5. rm -r: Removes a directory and its contents recursively.

    • Example: rm -rf directory-name (removes the directory and all its files).
  6. pwd: Prints the current working directory (as previously explained).

  7. cp: Copies files or directories.

    • Example: cp -r source-directory destination-directory (copies the source directory to the destination).
  8. mv: Moves or renames files or directories.

    • Example: mv old-directory new-directory (renames or moves the directory).

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!

0 Comments

no data
Be the first to share your comment!