[Chrome_OS]Crosh Shell终端 基础命令
Google’s Chrome OS includes a shell environment known as Chrome Shell, or “crosh” for short. Crosh includes several terminal commands that can be used on all Chromebooks, even ifdeveloper mode isn’t enabled.
Crosh includes commands for connecting to SSH servers, monitoring resource usage, debugging network problems, tweaking hidden hardware settings, performing hardware tests, and other debugging purposes.
Opening Crosh
To open the Crosh, press Ctrl+Alt+T anywhere in Chrome OS. The Crosh shell will open in a browser tab.
From here, you can run the help command to view a list of basic commands or run thehelp_advanced command for a list of “more advanced commands, mainly used for debugging.” We’ll cover some of the most interesting ones below.
ssh
Google provides an SSH client in the Chrome Web Store, but you don’t need to use it. You can use the built-in ssh command to connect to SSH servers without installing anything else on your Chromebook.
The ssh command is more advanced than you might expect. In addition to simply connecting to an SSH server, you can also use SSH tunneling to create a local proxy that allows you to tunnel your Chrome OS network activity over your SSH connection. You can also add private keys that you may need to connect to SSH servers.
ssh_forget_host
The ssh_forget_host command displays a list of known hosts you’ve connected to with the SSH command and allows you to “forget” a host. The next time you connect to the host, you’ll be asked to verify its key fingerprint again.
top
Chrome includes its own task manager that shows you which Chrome tabs, extensions, and plug-ins are using resources. However, Crosh also includes the top command from Linux, which gives you a display of all the low-level processes that may also be using resources. Most users will prefer using Chrome’s built-in task manager, but the top utility does provide more information. It also displays some information you can’t find elsewhere in Chrome OS, such as your Chromebook’s uptime.
ping
Yes, Chrome OS also has a ping command. Ping is an important utility for network troubleshooting, allowing you to see how long packets take to travel between your system and a web server and see whether any packets are being dropped. 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.
tracepath
The tracepath command functions similarly to traceroute, allowing you to trace the path packets take to reach a remote server. It’s another useful network-troubleshooting command, as it allows you to determine exactly where network problems are occurring between you and another networked device.
network_diag
The network_diag command performs a short set of network diagnostic tests, saving the output as a .txt file you can view in your Chromebook’s Files app.
sound
Chrome includes a command that can record audio from your Chromebook’s microphone and play it back later.
To record 10 seconds of audio from your Chromebook’s microphone, run the following command:
sound record 10
The audio will be saved as a file you can access from your Chromebook’s Files app. You can then play it back with the sound play command.
tpcontrol
The tpcontrol command allows you to fine-tune your device’s touchpad. Some of these options are available in Chrome OS’ settings window, but you can tweak many properties that aren’t available from the graphical interface.
xset m
The xset m command allows you to tweak your mouse acceleration rate. Chrome OS only has options for controlling the mouse’s speed in its graphical interface, so any fine-tuning of the acceleration rate — particularly useful if you’re using an external mouse that doesn’t work well with the default rate — must be done from here. The acceleration rate is configured in the same way you’d use the xset m command to configure acceleration rates on a standard Linux system.
xset r
The xset r command allows you to tweak the autorepeat behavior for when you hold a keyboard button down. You can select a delay before autorepeat starts and configure how many repeats occur per second. You can also disable autorepeat completely for every key on the keyboard or just disable autorepeat for specific keys.
Developer Mode Commands
In developer mode, you also have the following commands available to you:
- shell: Opens a full bash shell where you can run other Linux commands, including ones that can launch standard Linux desktop environments after you install them.
- systrace: Start system tracing, allowing you to capture logs for debugging purposes.
- packet_capture: Start capturing and logging packets.
You’ll find other commands if you run the help_advanced command — everything from memory tests and a Bluetooth debugging console to commands that let you control the debugging level for different background services. Many of these options are only useful for Chrome developers.