Skip to content

Latest commit

 

History

History
99 lines (46 loc) · 1.51 KB

File metadata and controls

99 lines (46 loc) · 1.51 KB
  1. Copy a file:

    
    cp <source file> <destination file>
    
    

    Example: cp file.txt /home/user/Documents/file.txt

  2. Move a file:

    
    mv <source file> <destination file>
    
    

    Example: mv file.txt /home/user/Documents/file.txt

  3. Delete a file:

    
    rm <file>
    
    

    Example: rm file.txt

  4. Create a new directory:

    
    mkdir <directory name>
    
    

    Example: mkdir my_directory

  5. Create a new file:

    
    touch <file name>
    
    

    Example: touch new_file.txt

  6. Rename a file or directory:

    
    mv <old name> <new name>
    
    

    Example: mv old_file.txt new_file.txt

  7. List files in a directory:

    
    ls <directory>
    
    

    Example: ls /home/user/Documents

  8. Change to a different directory:

    
    cd <directory>
    
    

    Example: cd /home/user/Documents

  9. Display the contents of a file:

    
    cat <file>
    
    

    Example: cat file.txt

These are just a few basic commands for common file and directory operations in Linux. There are many more commands available for more advanced tasks. You can find more information on Linux commands by using the man command followed by the command you are interested in, for example: man cp.