File and Path Commands
Commands for creating, copying, moving, inspecting, and removing files and directories within the sandbox filesystem.
basename
Strip directory and suffix from a filename.
basename /home/agent/project/main.go # main.go
basename /home/agent/project/main.go .go # maincat
Concatenate and print files.
cat file.txt
cat header.txt body.txt footer.txt > combined.txt
cat -n file.txt # number all lineschmod
Change file mode bits.
chmod 755 script.sh
chmod u+x script.sh
chmod -R 644 src/chown
Change file owner and group.
chown agent file.txt
chown agent:staff file.txtcp
Copy files and directories.
cp source.txt dest.txt
cp -r src/ backup/
cp -p original.txt copy.txt # preserve attributesdirname
Strip the last component from a path.
dirname /home/agent/project/main.go # /home/agent/projectdu
Estimate file space usage.
du -sh /home/agent/project
du -a src/file
Determine file type.
file image.png
file script.shfind
Search for files in a directory hierarchy.
find . -name "*.go"
find /home/agent -type f -name "*.txt"
find . -name "*.log" -size +1kln
Create symbolic links.
ln -s /home/agent/project/config.yaml config
ln -sf target.txt link.txt # force overwritelink
Create a hard link.
link original.txt hardcopy.txtls
List directory contents.
ls
ls -la /home/agent
ls -lh --sort=size src/dir
List directory contents. Behaves like ls.
dir /home/agent/projectmkdir
Create directories.
mkdir newdir
mkdir -p path/to/nested/dirmv
Move or rename files and directories.
mv old.txt new.txt
mv file.txt /home/agent/archive/readlink
Print the target of a symbolic link.
readlink symlink.txt
readlink -f relative/symlink # canonicalizerm
Remove files or directories.
rm file.txt
rm -r directory/
rm -rf build/rmdir
Remove empty directories.
rmdir emptydir
rmdir -p a/b/c # remove parents toostat
Display file status.
stat file.txttouch
Change file timestamps or create empty files.
touch newfile.txt
touch -m existing.txt # update modification timetree
List directory contents in a tree format.
tree
tree -L 2 src/
tree -d # directories onlyAdditional File and Path Utilities
These commands are also part of the default registry:
| Command | Description |
|---|---|
chgrp | Change file group ownership without changing the owning user |
dd | Copy raw data streams with block-size, skip, and count controls |
df | Report filesystem space usage for the current sandbox backend |
install | Copy files into place while setting permissions and ownership-like metadata |
mktemp | Create uniquely named temporary files or directories |
pathchk | Validate path names against portability and length rules |
realpath | Resolve a path to its canonical absolute location |
truncate | Set a file to an exact byte length |
unlink | Remove a single file path without recursive behavior |
vdir | Verbose directory listing equivalent to ls -l |
For flags and shell-facing help text, run help <command> inside gbash.