Skip to content

Files

Creating, copying, moving, linking and deleting files and directories, and finding out what a file really is.

Basics: Rules for working safely with files

Create

  • touch


    Create an empty file or update its timestamps.

  • mkdir


    Create directories, including missing parent directories.

Copy, move, delete

  • cp


    Copy files and directories.

  • mv


    Move or rename files and directories.

  • rm


    Delete files and directories permanently.

  • rmdir


    Delete empty directories safely.

  • shred


    Overwrite files securely before deleting them.

  • ln


    Create symbolic and hard links.

Inspect and change

  • stat


    Show all metadata: size, permissions, owner and timestamps.

  • file


    Detect the file type from its content.

  • truncate


    Empty, shorten or enlarge a file to an exact size.