Crosh Commands (ChromeOS Shell Commands)

This page has two sections. First up is a quick and dirty guide (originally posted as its own article) on actually getting into and using the cross environment. The second is a table with a deeper dive into the actual commands and their options. Basic Crosh Functionality To open Crosh: Control-Alt-T Find commands: help Find debugging commands: help_advanced To switch to a more bash-like command prompt: shell To see the version of Chrome OS running on your Chromebook: sudo /opt/google/chrome/chrome –version To show the operating system name: uname -a If the operating system is a bit old, update it using the update_engine_client command: update_engine_client -update To see the bios of your Chromebook, open up a command prompt (Control-Alt-T) and use the following command: sudo /usr/sbin/chromeos-firmwareupdate -V To record some sound from the microphone, use the sound command: sound record NUMBEROFSECONDS Look for (or grep for) BIOS version in the output. To see the Vital Product Data, or configuration information such as time zone, UUID, IMEI, model, region, language, keyboard layout and serial number: sudo dump_vpd_log –full –stdout Or to be specific about what you’re looking for, grep for it: sudo dump_vpd_log –full –stdout | grep “serial_number” To capture some logs for debugging, use systrace: sudo systrace To manage the mouse and keyboard acceleration and autorepeat options, use the xset command: xset m Trace a network path (like traceroute or tracert): tracepath www.google.com To run standard network diagnostics: network_diag To capture some packets while troubleshooting network connections, use the packet_capture command: packet_capture Check the type, version, etc on your touchpad: tpcontrol status You can also debug network connections by logging data going through either the wifi, cellular or ethernet interface using the network_logging command. To do so for a normal 802.11 connection: network_logging wifi To configure WAP information: wpa_cli Accept an SSL Cert by using the enterprise_ca_approve command: enterprise_ca_approve –allow-self-signed https://entca.krypted.com Many standard Linux commands work as well, including route, mount, cat, cp, chmod, reboot, echo, tr, cut, mkdir, see, if/then, ls, cd, pwd, su, sudo, etc. To see IP address information: sudo ifconfig eth0 To see all of the running processes: top To see a user’s hid and gid, use id: id To see more information To ping Google: ping www.google.com To connect to another system, you can use ssh and there’s an ssh_forget_host command to clear a given host from your hosts list. To see a list of the commands you’ve run: shell_history To close the command prompt: exit By default, the Chromium OS rootfs is read-only. If you boot the system in developer mode, you will be able to disable rootfs verification and modify existing files or write new files into the file system. Before you do this, note that your file system will no longer be verifiable (won’t checksum properly) and you’ll end up needing to restore a recovery image in order to get back to normal mode. So this might be a bit dangerous if you’re not using the device for something like regression analysis (why I needed to do this). To make the file system writeable, first fire up a command prompt via crosh, by using Control-Alt-T and then running the shell command at the shell prompt: shell Then run the following shell script to remote rootfs verification and make the file system writeable: sudo /usr/share/vboot/bin/make_dev_ssd.sh –remove_rootfs_verification Then reboot and do whatever it is you need to do.For example, install a vine server and run automation scripts to do regression testing. Enjoy. Command Purpose exit Exit the crosh Shell help Display the crosh help help_advanced Show advanced crosh commands; primarily used for debugging. ping [-c count] [-i interval] [-n] [-s packetsize] [-W waittime] < destination > Send ICMP ECHO_REQUEST packets to a network host. If < destination > is “gw” then the next hop gateway for the default route is used. It works just like the ping command on other operating systems. Press Ctrl+C to stop the ping process or halt any other command in Crosh. ssh Starts the ssh subsystem if invoked without any arguments. “ssh < user > < host >”, “ssh < user > < host > < port >”, “ssh < user >@< host >”. or “ssh < user >@< host > < port >” connect without entering the subsystem. ssh_forget_host Remove a host from the list of known ssh hosts. This command displays a menu of known hosts and prompts for the host to forget. top Sets the chapsd log level. No arguments can start verbose logging. live_in_a_coal_mine battery_test [< test length >] Use the canary channel Tests battery discharge rate for given number of seconds. No argument will default to 300s test. bt_console <agent> Enable the Bluetooth debugging console chaps_debug [start | stop | < log_level >] Sets the chapsd logging level. No arguments will start verbose logging. connectivity Shows connectivity status. experimental_storage < status | enable | disable > Enable or disable experimental storage features. ff_debug [< tag_expr >] [–help] [–list_valid_tags] [–reset] Add and remove ff debugging tags. memory_test Performs extensive memory testing on the available free memory. modem < command > [args…] Interact with the 3G modem. Run “modem help” for detailed help. modem_set_carrier carrier-name Configures the modem for the specified carrier. network_diag [–date] [–link] [–show-macs] [–wifi] [–help] [–wifi-mon] < host > A function that performs a suite of network diagnostics. Saves a copy of the output to your download directory. network_logging < wifi | cellular | ethernet > A function that enables a predefined set of tags useful for debugging the specified device. p2p_update [enable | disable] Enables or disables the peer-to-peer (P2P) sharing of updates over the local network. This will both, attempt to get updates from other peers in the network and share the downloaded updates with them. Run this command without arguments to see the current state. rlz < status | enable | disable > Enable or disable RLZ. rollback Attempt to rollback to the previous update cached on your system. Only available on non-stable channels and non-enterprise enrolled devices. Please note that this will powerwash your device. route [-n] [-6] Display the routing tables. set_apn [-n < network-id >] [-u < username >] [-p < password >] < apn > Set the APN to use when connecting to the network specified by < network-id >. If < network-id > is not specified, use the network-id of the currently registered network. set_apn – c Clear the APN to be used, so that the default APN will be used instead. set_arpgw < true | false > Turn on extra network state checking to make sure the default gateway is reachable. set_cellular_ppp [-u < username >] [-p < password >] Set the PPP username and/or password for an existing cellular connection. If neither -u nor -p is provided, show the existing PPP username for the cellular connection. set_cellular_ppp -c Clear any existing PPP username and PPP password for an existing cellular connection. sound < command > < argument > Low level sound configuration. Can be used to play/record audio samples and enable beam forming on Pixel. “sound beamforming < on | off >” will enable/disable the feature. “sound record [duration]” will start recording. “sound play < filename >” will play the recorded audio samples. storage_status Reads storage device SMART health status, vendor attributes and error log. storage_test_1 Performs a short offline SMART test. storage_test_2 Performs an extensive readability test. syslog < message > Logs a message to syslog. tpcontrol {status | taptoclick [on|off] sensitivity [1-5] | set < property > <value>} tpcontrol {syntp [on|off]} Manually adjust advanced touchpad settings. tracepath [-n] < destination >[/port] Trace the path/route to a network host. update_over_cellular [enable|disable] Enables or disables the auto updates over cellular networks. Run without arguments to see the current state. upload crashes Uploads available crash reports to the crash server. wpa_debug [< debug_level >] [–help] [–list_valid_level] [–reset] Set wpa_supplicant debugging level. xset m [acc_mult[/acc_div] [thr]] xset m default Tweak the mouse acceleration rate. xset r rate [delay [rate]] Tweak autorepeat rates. The delay is the number of milliseconds before autorepeat starts. The rate is the number of repeats per second. xset r [keycode] < on|off > Turn autorepeat on/off. If keycode is specified, it affects only that key. If not specified, it affects global behavior.