Catalog / Chrome OS Terminal Cheatsheet

Chrome OS Terminal Cheatsheet

A handy reference guide for using the Chrome OS Terminal, covering essential commands, shortcuts, and configurations for developers and system administrators.

Basic Commands and Navigation

Essential Commands

pwd

Print working directory (shows the current directory path).

ls

List directory contents (files and directories).

cd

Change directory (navigate to a different directory).
Example: cd Documents

mkdir

Create a new directory.
Example: mkdir MyProject

rmdir

Remove an empty directory.

rm

Remove files.
Example: rm myfile.txt

cp

Copy files or directories.
Example: cp file1.txt file2.txt

mv

Move or rename files or directories.
Example: mv oldname.txt newname.txt

File Operations

cat

Concatenate and display file content.

less

View file content page by page.
Press q to exit.

head

Display the first few lines of a file.

tail

Display the last few lines of a file.

nano

Simple text editor for creating and modifying files.

chmod

Change file permissions.

chown

Change file owner.

Package Management and System Info

Package Management (Debian/Ubuntu)

sudo apt update

Update the package lists.

sudo apt upgrade

Upgrade installed packages.

sudo apt install <package_name>

Install a new package.
Example: sudo apt install vim

sudo apt remove <package_name>

Remove a package.

sudo apt autoremove

Remove automatically all unused packages.

sudo apt search <package_name>

Search for a package.

System Information

uname -a

Display kernel information.

lsb_release -a

Display Linux distribution information.

df -h

Display disk space usage.

free -m

Display memory usage.

top

Display system processes.

htop

Improved interactive process viewer (if installed).

lscpu

Display CPU information.

Networking

ip addr

Show network interfaces and IP addresses.

ping <hostname>

Test network connectivity to a host.

netstat -tulnp

Display network connections and listening ports.

Shortcuts and Productivity

Keyboard Shortcuts

Ctrl + Shift + T

Reopen last closed tab.

Ctrl + Tab

Switch to the next tab.

Ctrl + Shift + Tab

Switch to the previous tab.

Ctrl + +

Zoom in.

Ctrl + -

Zoom out.

Ctrl + 0

Reset zoom.

Ctrl + C

Interrupt a running process.

Terminal Customization

Right-click on the terminal window and select ‘Settings’ to customize:

  • Appearance (font, colors)
  • Behavior (shell, tab management)
  • Keyboard shortcuts

Edit .bashrc file to customize the terminal, to change:

  • Aliases
  • Functions
  • Environment variables

Shell Navigation

Up Arrow

Recall previous command.

Down Arrow

Recall next command.

Ctrl + R

Search command history.

Tab

Autocomplete file or command name.

Advanced Usage and Crostini

Working with Crostini (Linux Environment)

Crostini allows running Linux applications on Chrome OS. Access it through the Terminal app.

  • Sharing Files: Files in your Chrome OS ‘Downloads’ folder are automatically shared with the Linux environment.
  • Accessing USB Devices: USB support requires enabling specific flags and configurations.

Troubleshooting

  • Terminal Not Responding: Try closing and reopening the terminal. If the issue persists, restart Crostini or Chrome OS.
  • Package Installation Issues: Ensure package lists are updated (sudo apt update).
  • Network Problems: Check network connectivity and DNS settings.

Advanced Commands

grep

Search for patterns in files.
Example: grep 'error' logfile.txt

find

Find files based on various criteria.
Example: find . -name '*.txt'

xargs

Build and execute command lines from standard input.

rsync

Remote file synchronization.
Example: rsync -avz /local/path user@remote:/remote/path

screen or tmux

Terminal multiplexers for managing multiple terminal sessions.