😎
CS1.dev
  • Welcome to Computer Science 1
  • Unit 2
    • Activity 2.1
    • Activity 2.2
    • Activity 2.3
    • Activity 2.4
    • Activity 2.5
    • Activity 2.6
    • Activity 2.7
    • Activity 2.9
    • Activity 2.10
    • Project 2
    • Activity 2.8
    • Activity 2.11
    • Activity 2.12
    • Activity 2.13
    • Activity 2.14
    • Activity 2.15
    • Activity 2.16
    • Activity 2.17
    • Activity 2.18
    • Activity 2.19
    • Project 3
    • Activity 2.20
    • Activity 2.21
    • Activity 2.22
    • Activity 2.23
    • Activity 2.24
    • Project 4
    • Activity 2.25
    • Activity 2.26
    • Activity 2.27
    • Activity 2.28
    • Project 5
    • Activity 2.29
    • Activity 2.30
    • Activity 2.31
    • Activity 2.32
    • Activity 2.33
    • Activity 2.34
    • Activity 2.35
    • Activity 2.36
  • Unit 3
    • Activity 3.1
    • Activity 3.2
    • Activity 3.3
    • Activity 3.4
    • Activity 3.5
    • Activity 3.6
    • Activity 3.7
    • Activity 3.8
    • Activity 3.9
    • Activity 3.10
    • Activity 3.11
    • Project 6
    • Activity 3.12
  • Activity 3.13
  • Activity 3.14
  • Activity 3.15
  • Activity 3.16
  • Project 7
  • Activity 3.17
  • Activity 3.18
  • Activity 3.19
  • Project 8
  • Linux
    • bash
    • cat
    • cd
    • chmod
    • df
    • echo
    • find
    • grep
    • less
    • ls
    • mkdir
    • more
    • pwd
    • tar
    • touch
    • unzip
    • zip
Powered by GitBook
On this page
  1. Linux

cd

The cd command in Linux is a fundamental command line utility used for navigating the filesystem. It stands for "change directory." By using cd, you can move around different directories (folders) in the filesystem from the terminal. Here are some key aspects of the cd command:

  1. Basic Usage: To move into a specific directory, you type cd followed by the path to the directory. For example, cd /path/to/directory will change your current directory to /path/to/directory.

  2. Home Directory: Just typing cd without any arguments takes you to your home directory. The home directory is also represented by ~. So, cd ~ has the same effect.

  3. Relative and Absolute Paths: cd can be used with both relative and absolute paths. An absolute path starts from the root directory (e.g., /usr/local/bin), while a relative path starts from the current directory (e.g., documents/projects).

  4. Parent Directory: cd .. moves you up one level to the parent directory of the current directory.

  5. Previous Directory: cd - switches you to the last directory you were in. This is useful for toggling back and forth between two directories.

  6. Tab Completion: When typing a directory path in the terminal, you can use the Tab key for auto-completing the directory names, which saves time and reduces typing errors.

  7. Navigating Spaces in Directory Names: If a directory name contains spaces, you either need to escape the spaces with a backslash (e.g., cd My\ Documents) or enclose the entire path in quotes (e.g., cd "My Documents").

  8. Case Sensitivity: Remember that Linux is case-sensitive. So, Documents and documents are considered different directories.

  9. Symbolic Links: When you change directories into a symbolic link, you are moved into the location that the link points to.

  10. No Command Output: Normally, cd doesn’t produce any output. It silently changes the directory and updates the shell's current directory. You can verify the change with the pwd command.

PreviouscatNextchmod

Last updated 1 year ago