5 MUST-HAVE TERMINAL COMMANDS FOR LINUX ON YOUR CHROMEBOOK

We’ve spent a lot of time over the past week exploring what is possible on Chrome OS. Thanks to some updates to the Linux container, we’ve installed Windows 10 and a variety of Linux flavors. I love tinkering with Chrome OS to see how far I can push the maturing ecosystem but today, we’re going to focus on what the Linux container is currently designed to do. That, of course, it to run the Debian framework and allow users to install compatible Linux applications on Chrome OS. Doing so doesn’t require you to be a Linux guru and thank goodness for that. I’m still learning as I go but mastering the Chrome OS Linux terminal doesn’t have to be a terrifying or even daunting.

That said, we’re going to look at five terminal commands every Chromebook user should know if you plan on getting the most out of the Linux container. There are more commands than we could ever cover here and I will follow up frequently with more tutorials on basic and complex commands over the coming weeks. These five, I’ve found, are five that I use very frequently. Some perform simply tasks while others wield much power. I’ll lay them out, in no specific order, and give you a quick example of how to use them.

Sudo

The sudo command originally meant “superuser do” because it ran commands as the root super user without any privilege restrictions. More recent iterations allow users to run commands not only as the unrestricted root user but other, restricted users as well. In a full-blown Linux desktop environment, the sudo command isn’t needed as frequently as it is when you’re living life inside the terminal. For Chrome OS, using sudo more the rule than the exception. Many of the commands we use inside the Chromebook Linux terminal will require root access. Therefore, sudo is appended to the front of whatever command it is you are executing.

For example, when we are checking the Debian repository for package updates, we use the command apt-get update. Many Linux distros do this action via whatever software center they use and the priveliges needed are already in place. Like other operating systems, you will see an update notification and simply click to update. Since the default user in the Chrome OS Linux terminal isn’t technically the super user, you have to run the update command with sudo at the beginning like so:

sudo apt-get update

If you attempt to run a command in the terminal and you receive a message that says “are you root?,” then adding sudo will normally complete the execution. To switch to the root user in the terminal and negate the need for sudo, you can simply run the command sudo su and you will now be using the super user account.

cd

The cd command stands for “change directory” and it does exactly what you would think. In Chrome OS, the default directory for the command line is the Linux folder that’s in your Files App. Sometimes, you will need to access files that are not in the same tree as the Linux folder. Example: You need to add a third-party repository to your sources.list file so that you can download a package not available from Debian Stretch. The cd command is how you point the terminal toward the folder you are wanting to work with at that moment. In the example above, you would enter cd /etc/apt in the terminal. From there, you would be able to open the sources.list file with a text editor. If you are working a number of nested “folder,” you can move up one directory by typing cd .. and hitting enter.

top

Task managers are very handy little creatures and practically every operating system has its own iteration. Outside of the desktop environment, the top command is the quickest way to see what resources are being used by which packages. This command will give you a snapshot of cpu and memory usage along with other useful bits of information such as task ownership, shared memory and more. This is a quick, easy way to identify what packages may be draining your precious system resources.

Legend:

PID: Shows task’s unique process id.

PR: Stands for priority of the task.

SHR: Represents the amount of shared memory used by a task.

VIRT: Total virtual memory used by the task.

USER: User name of owner of task.

%CPU: Represents the CPU usage.

TIME+: CPU Time, the same as ‘TIME’, but reflecting more granularity through hundredths of a second.

SHR: Represents the Shared Memory size (kb) used by a task.

NI: Represents a Nice Value of task. A Negative nice value implies higher priority, and positive Nice value means lower priority.

%MEM: Shows the Memory usage of task.

ls

If you just want to see what files are inside a given directory, look no further than the ls command. Typing this command in the terminal will show you every file and directory inside the current directory. This makes it a lot easier to cd into another folder when you have a large number of files and you aren’t sure which one you need to open. The color of the text output will vary depending on what type of items are in the given folder. In my terminal, Folders/directories are blue and files are white or teal depending on their file type. If you’re trying to run a command and you get a “not found” error, ls is a quick way to see if the file exists in the active directory.

uname

To find out basic system information, the uname command is what you need. If you type uname in the terminal and hit enter, the output should be “Linux” as that’s what’s running in the container. For a bit more detail, you can type uname -a and you will see the OS, Linux kernel version, release date and the native architecture of your container. This information is especially useful if you are running into issues with a program and are seeking help from other users. Kernel information and system architecture play a bit part in package compatibility and it’s good to have it on hand at a moment’s notice.

Bonus command!

With the 4th installment of the Matrix in the works, wouldn’t it be fun to turn your terminal into a Matrix screensaver? You can do just that by installing cmatrix. Just install it with the command sudo apt install cmatrix and then type cmatrix in the terminal and hit enter. Pretty cool, huh? To exit the Matrix, just hit Ctrl+C and you’ll return to the command line prompt. That’s all for today. See you later this week as we dig a little deeper into the Linux terminal for Chrome OS.

Leave a comment

Your email address will not be published. Required fields are marked *