File Handling

TermiPy provides a range of commands for file and directory operations. This guide covers the most commonly used file handling commands.

Listing Files and Directories

getwd

Get working directory.

@termipy >> getwd

ls

List contents of the current directory.

@termipy >> ls

tree [directory]

Show directory structure

@termipy >> tree
@termipy >> tree /path/to/directory

or restricting the depth of the tree

@termipy >> tree -l 2

Creating Files and Directories

create <path>

Create a new file or directory

@termipy >> create new_file.txt
@termipy >> create new_directory/

Deleting Files and Directories

delete <path>

Delete a file or directory

@termipy >> delete old_file.txt
@termipy >> delete old_directory/

Renaming Files and Directories

rename <old> <new>

Rename a file or directory

@termipy >> rename old_name.txt new_name.txt

Searching for Files

search <filename>

Search for a file in the current directory and subdirectories

@termipy >> search important_doc.pdf

File Permissions

permissions <file>

Show file permissions

@termipy >> permissions myfile.txt

Disk Usage

diskusage [path]

Show disk usage for a specific path or the current directory

@termipy >> diskusage
@termipy >> diskusage /home/user

File Details

about <file>

Show file details

@termipy >> about myfile.txt

Tips for File Handling

  1. Use tab completion to quickly navigate directories and input file names.

  2. When dealing with files or directories with spaces in their names, use quotes:

    @termipy >> setwd "My Documents"
  3. Be cautious when using the delete command, as it permanently removes files and directories.

  4. Use the tree command with a depth parameter to limit the levels shown:

    @termipy >> tree -l 2