What are common file commands?

076

Here are some common file commands used in Linux:

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

    ls
  2. cd: Changes the current directory.

    cd /path/to/directory
  3. pwd: Prints the current working directory.

    pwd
  4. touch: Creates a new empty file or updates the timestamp of an existing file.

    touch filename.txt
  5. cp: Copies files or directories.

    cp source.txt destination.txt
  6. mv: Moves or renames files or directories.

    mv oldname.txt newname.txt
  7. rm: Removes (deletes) files or directories.

    rm filename.txt
  8. mkdir: Creates a new directory.

    mkdir new_directory
  9. rmdir: Removes an empty directory.

    rmdir empty_directory
  10. cat: Displays the contents of a file.

    cat filename.txt
  11. head: Displays the first few lines of a file.

    head filename.txt
  12. tail: Displays the last few lines of a file.

    tail filename.txt
  13. chmod: Changes the permissions of a file or directory.

    chmod 755 filename.txt
  14. chown: Changes the owner of a file or directory.

    chown user:group filename.txt

These commands are essential for managing files and directories in a Linux environment.

0 Comments

no data
Be the first to share your comment!