{"id":2117,"date":"2020-08-10T06:04:12","date_gmt":"2020-08-10T06:04:12","guid":{"rendered":"https:\/\/www.tech-battery.com\/batteriesblog\/?p=2117"},"modified":"2020-08-10T06:04:12","modified_gmt":"2020-08-10T06:04:12","slug":"5-must-have-terminal-commands-for-linux-on-your-chromebook","status":"publish","type":"post","link":"https:\/\/www.tech-battery.com\/batteriesblog\/5-must-have-terminal-commands-for-linux-on-your-chromebook\/","title":{"rendered":"5 MUST-HAVE TERMINAL COMMANDS FOR LINUX ON YOUR CHROMEBOOK"},"content":{"rendered":"\n<p>We\u2019ve 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\u2019ve 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\u2019re 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\u2019t require you to be a Linux guru and thank goodness for that. I\u2019m still learning as I go but mastering the Chrome OS Linux terminal doesn\u2019t have to be a terrifying or even daunting.<\/p>\n\n\n\n<p>That said, we\u2019re 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\u2019ve found, are five that I use very frequently. Some perform simply tasks while others wield much power. I\u2019ll lay them out, in no specific order, and give you a quick example of how to use them.<\/p>\n\n\n\n<p>Sudo<\/p>\n\n\n\n<p>The&nbsp;sudo&nbsp;command originally meant \u201csuperuser do\u201d 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\u2019t needed as frequently as it is when you\u2019re living life inside the terminal. For Chrome OS, using&nbsp;sudo&nbsp;more the rule than the exception. Many of the commands we use inside the Chromebook Linux terminal will require root access. Therefore,&nbsp;sudo&nbsp;is appended to the front of whatever command it is you are executing.<\/p>\n\n\n\n<p>For example, when we are checking the Debian repository for package updates, we use the command&nbsp;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\u2019t technically the super user, you have to run the update command with&nbsp;sudo&nbsp;at the beginning like so:<\/p>\n\n\n\n<p>sudo apt-get update<\/p>\n\n\n\n<p>If you attempt to run a command in the terminal and you receive a message that says \u201care you&nbsp;root?,\u201d then adding&nbsp;sudo&nbsp;will normally complete the execution. To switch to the root user in the terminal and negate the need for&nbsp;sudo, you can simply run the command&nbsp;sudo su&nbsp;and you will now be using the super user account. <\/p>\n\n\n\n<p>cd<\/p>\n\n\n\n<p>The&nbsp;cd&nbsp;command stands for \u201cchange directory\u201d and it does exactly what you would think. In Chrome OS, the default directory for the command line is the Linux folder that\u2019s 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&nbsp;sources.list&nbsp;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&nbsp;cd \/etc\/apt&nbsp;in the terminal. From there, you would be able to open the&nbsp;sources.list&nbsp;file with a text editor. If you are working a number of nested \u201cfolder,\u201d you can move up one directory by typing&nbsp;cd ..&nbsp;and hitting enter.<\/p>\n\n\n\n<p>top<\/p>\n\n\n\n<p>Task managers are very handy little creatures and practically every operating system has its own iteration. Outside of the desktop environment, the&nbsp;top&nbsp;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.<\/p>\n\n\n\n<p>Legend:<\/p>\n\n\n\n<p>PID:&nbsp;Shows task\u2019s unique process id.<\/p>\n\n\n\n<p>PR:&nbsp;Stands for priority of the task.<\/p>\n\n\n\n<p>SHR:&nbsp;Represents the amount of shared memory used by a task.<\/p>\n\n\n\n<p>VIRT:&nbsp;Total virtual memory used by the task.<\/p>\n\n\n\n<p>USER:&nbsp;User name of owner of task.<\/p>\n\n\n\n<p>%CPU:&nbsp;Represents the CPU usage.<\/p>\n\n\n\n<p>TIME+:&nbsp;CPU Time, the same as \u2018TIME\u2019, but reflecting more granularity through hundredths of a second.<\/p>\n\n\n\n<p>SHR:&nbsp;Represents the Shared Memory size (kb) used by a task.<\/p>\n\n\n\n<p>NI:&nbsp;Represents a Nice Value of task. A Negative nice value implies higher priority, and positive Nice value means lower priority.<\/p>\n\n\n\n<p>%MEM:&nbsp;Shows the Memory usage of task.<\/p>\n\n\n\n<p>ls<\/p>\n\n\n\n<p>If you just want to see what files are inside a given directory, look no further than the&nbsp;ls&nbsp;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&nbsp;cd&nbsp;into another folder when you have a large number of files and you aren\u2019t 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\u2019re trying to run a command and you get a \u201cnot found\u201d error,&nbsp;ls&nbsp;is a quick way to see if the file exists in the active directory.<\/p>\n\n\n\n<p>uname<\/p>\n\n\n\n<p>To find out basic system information, the&nbsp;uname&nbsp;command is what you need. If you type&nbsp;uname&nbsp;in the terminal and hit enter, the output should be \u201cLinux\u201d as that\u2019s what\u2019s running in the container. For a bit more detail, you can type&nbsp;uname -a&nbsp;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\u2019s good to have it on hand at a moment\u2019s notice.<\/p>\n\n\n\n<p>Bonus command!<\/p>\n\n\n\n<p>With the 4th installment of the Matrix in the works, wouldn\u2019t it be fun to turn your terminal into a Matrix screensaver? You can do just that by installing&nbsp;cmatrix.&nbsp;Just install it with the command&nbsp;sudo apt install cmatrix&nbsp;and then type&nbsp;cmatrix&nbsp;in the terminal and hit enter. Pretty cool, huh? To exit the Matrix, just hit Ctrl+C and you\u2019ll return to the command line prompt. That\u2019s all for today. See you later this week as we dig a little deeper into the Linux terminal for Chrome OS.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We\u2019ve 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\u2019ve 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\u2019re going &hellip; <a href=\"https:\/\/www.tech-battery.com\/batteriesblog\/5-must-have-terminal-commands-for-linux-on-your-chromebook\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;5 MUST-HAVE TERMINAL COMMANDS FOR LINUX ON YOUR CHROMEBOOK&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[171],"class_list":["post-2117","post","type-post","status-publish","format-standard","hentry","category-systems-and-procedures","tag-chromebook"],"_links":{"self":[{"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/posts\/2117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/comments?post=2117"}],"version-history":[{"count":1,"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/posts\/2117\/revisions"}],"predecessor-version":[{"id":2118,"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/posts\/2117\/revisions\/2118"}],"wp:attachment":[{"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/media?parent=2117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/categories?post=2117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tech-battery.com\/batteriesblog\/wp-json\/wp\/v2\/tags?post=2117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}