Skip to main content
Glama
gunjanjp

Linux Bash MCP Server

by gunjanjp
file_operations.sh1.07 kB
#!/bin/bash # Example bash script for file operations # Usage: file_operations.sh [directory] [pattern] DIRECTORY=${1:-"/tmp"} PATTERN=${2:-"*"} echo "=== File Operations Script ===" echo "Directory: $DIRECTORY" echo "Pattern: $PATTERN" echo "Date: $(date)" echo "" # Check if directory exists if [ ! -d "$DIRECTORY" ]; then echo "Error: Directory '$DIRECTORY' does not exist!" exit 1 fi echo "=== Directory Contents ===" ls -la "$DIRECTORY" echo "" echo "=== Files matching pattern '$PATTERN' ===" find "$DIRECTORY" -name "$PATTERN" -type f 2>/dev/null | head -20 echo "" echo "=== Directory Size ===" du -sh "$DIRECTORY" echo "" echo "=== File Count by Type ===" find "$DIRECTORY" -type f 2>/dev/null | sed 's/.*\.//' | sort | uniq -c | sort -nr | head -10 echo "" echo "=== Recently Modified Files (Last 24 hours) ===" find "$DIRECTORY" -type f -mtime -1 2>/dev/null | head -10 echo "" echo "=== Largest Files ===" find "$DIRECTORY" -type f -exec ls -lh {} \; 2>/dev/null | sort -k5 -hr | head -10 echo "" echo "File operations completed successfully!"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gunjanjp/linuxshell-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server