The pwd command differs from other directory-related commands in Linux in its specific function and output. Here’s a comparison with some common directory-related commands:
-
pwd(Print Working Directory):- Purpose: Displays the full path of the current working directory.
- Output: Only shows the path, e.g.,
/home/user/documents.
-
cd(Change Directory):- Purpose: Changes the current working directory to a specified path.
- Output: Does not produce output unless there is an error; it simply changes your location.
-
ls(List):- Purpose: Lists the contents of the current directory or a specified directory.
- Output: Displays files and subdirectories, e.g.,
file1.txt,folder1.
-
mkdir(Make Directory):- Purpose: Creates a new directory.
- Output: No output if successful; it creates a directory at the specified path.
-
rmdir(Remove Directory):- Purpose: Deletes an empty directory.
- Output: No output if successful; it removes the specified directory.
Summary:
pwd: Shows where you are (current directory).cd: Moves you to a different directory.ls: Lists what’s in a directory.mkdirandrmdir: Create and remove directories, respectively.
If you have more questions or need further clarification, feel free to ask!
