Skip to main content

Bash Cheatsheet

The following are commonly used commands used when working with a Pocket Node.

Linux Commands

  • ssh <user>@<host> - SSH into a remote host using a password.
  • ssh -i <keyfile> <user>@<host> - SSH into a remote host using a private key.
  • pwd - Prints the current working directory.
  • ls - Lists the contents of the current directory.
  • cd - Changes the current working directory.
  • df - Displays the disk space usage.
  • dd -h - Displays the disk space usage in human readable format.
  • mkdir - Creates a directory.
  • touch - Creates a file.
  • rm - Removes a file or directory.
  • cp - Copies a file or directory.
  • mv - Moves a file or directory.
  • cat - Displays the contents of a file.
  • grep - Searches for a string in a file.
  • head - Displays the first few lines of a file.
  • tail - Displays the last few lines of a file.
  • less - Displays the contents of a file in a pager.
  • more - Displays the contents of a file in a pager.
  • nano - A text editor.
  • vim - A text editor.
  • vi - A text editor.
  • chmod - Changes the permissions of a file or directory.
  • chown - Changes the owner of a file or directory.
  • sudo - Runs a command as the super user.
  • su - Runs a command as another user.
  • top - Shows the processes running on the node.
  • htop - Interactive version of top.
  • kill <pid> - Kills a process by its PID.
  • kill -KILL <pid> - Forcefully kill a process.
  • killall -9 <name> - Kills all processes by name.
  • w or who - Shows users logged in to the host.
  • skill -KILL -u <user> - Kills all processes owned by a user and logs them out.
  • pkill -KILL -u <user> <process> - Kills all processes owned by a user.
  • whoami - Shows the current user.
  • curl - Makes a HTTP request.
  • man <topic> - Opens the manual for a topic.
  • ps -fu <user> - See running processes for a user.
  • passwd <user> - Set the password for a user.
  • cat /etc/passwd - List users on the system.
  • sudo usermod -l <new_login_name> <old_login_name> - Change the user's login name.
  • usermod -d <new_home_directory_path> username - Change the user's home directory.
  • userdel -r <username> - Delete a user.

Pocket CLI Commands

  • pocket start --simulateRelay=true - Starts to simulate/test the relay setup.
  • pocket start - Start the Pocket daemon.
  • pocket stop - Stop the Pocket daemon.
  • pocket query height - Returns the current block height.
  • pocket accounts create - Creates a new account.
  • pocket accounts list - List all the accounts on the node.
  • pocket accounts show <address> - Show the details of an account.
  • pocket accounts get-validator - Shows the account that is used for the validator.
  • pocket accounts set-validator <address> - Sets the account that is used for the validator.
  • pocket nodes stake <address> <amount> <relay_chains> <serviceURI> mainnet 10000 true - Stake a node.
  • pocket accounts import-armored <armoredJSONFile> - Imports an account from an armored JSON file.
  • pocket accounts export [--path <path>] <address> - Export an account to an armored JSON file.
  • pocket accounts update-passphrase <address> - Update the passphrase of an account.
  • pocket accounts send-tx <fromAddr> <toAddr> <amount> <chainID> <fee> <memo> - Send a transaction.

    note is that the <amount> and <fee> are in the smallest unit of the currency - uPOKT. The formula for converting POKT to uPOKT is (10 ^ 6) * X where X is the amount of POKT.