Since I think it's useful for anyone that owns a Pi to know the basics of executing commands in a terminal this script has no GUI. This way it can be used on any PC that includes the bash shell and an ssh client program, it should even work from Windows if you edit the filesystem path's and names of the bash and ssh executables in the script.
Features:
[Picmd Version 0.0.1]
Usage:
picmd [action] [arguments]
Actions: Arguments:
configure : Create new config file
add-key : Upload public ssh key to Pi
connect : Open a remote BASH shell
execute - Any command
execute-x11 - gui-program (forward remote X11 apps to local xorg)
reboot
poweroff
list-shares : List remote shares
sshmount - /remote/directory /local/mount/point
root-sshmount - /remote/directory /local/mount/point
unmount - /local/mount/point
service - service-name [start|stop|restart|status]
- list (lists all available services)
autostart - service-name [enable|disable]
firewall - port/type [allow|deny]
- [enable|disable|status]
upload - local/file /remote/directory
download - /remote/file /local/directory
update : Update server apt sources
upgrade : Perform update and do dist-upgrade
install - app-1 app-2 app-ect
uninstall - app-1 app-2 app-ect
apt-search - app-name
clean : clean apt cache + autoremove orphaned packages
mplay - /remote/path/to/music/dir/or/file.mp3
mplaylist - /remote/path/to/playlist.txt
help : Display this help text
Examples:
Start a Bash shell on the Pi:
Code: Select all
picmd connectCode: Select all
picmd execute ls /var/www/html/Code: Select all
picmd sshmount /media/music /home/username/Music/
picmd unmount /home/username/Music/Code: Select all
picmd install package-name otherPackage stuff
picmd uninstall package-name
picmd upgrade
picmd apt-search firefoxCode: Select all
picmd upload /home/username/nice-image.png /var/www/html/my-site/
picmd download /var/www/html/my-site/index.html /home/username/Workspace/my-site/Install the NginX webserver, enable it to start at system boot and allow firewall traffic on TCP port 80:
Code: Select all
picmd upgrade
picmd install apache2
picmd autostart apache2 enable
picmd firewall 80/tcp allow
picmd firewall 22/tcp allow
picmd firewall enableCode: Select all
mkdir pi-mount
picmd list-shares
picmd sshmount /media/myusbdisk pi-mount/
# Open the pi-mount folder in your file manager
picmd unmount pi-mount/Install:
Use GIT to clone the scripts to your PC or download a zip archive.:
Code: Select all
git clone https://github.com/socialdefect/picmd.gitCode: Select all
cd picmdCode: Select all
./picmdTo be able to run the script from any directory you need to copy it in your executable PATH:
Code: Select all
sudo cp picmd /usr/local/bin/Code: Select all
ssh-keygen
# Press [Enter] twice to create a key pair with empty password
picmd add-keyCode: Select all
picmd upload *mplaylist /usr/local/bin/
picmd install mplayer