Practicing the Linux command line interface

Edited on September 9, 2021

These exercises are done on a ThinkPad T460S running Linux Mint version 20.2 (Uma)

During our last lesson we learned about quite many cli commands. For this week we were tasked to practice using cli commands and to try out a few specific ones that we would report on.

Command permissions

The first task was to try out two events that would be present in the log files, on of which should fail and one succeed. I chose the following command to do this:

  • sudo apt-get update
  • sudo less /var/log/auth.log

First with an incorrect password and then with the correct one. The logs for these events were the following:

  • Sep 2 15:27:06 TpadJ sudo: juuso : 1 incorrect password attempt ; TTY=pts/0 ; PWD=/home/juuso ; USER=root ; COMMAND=/usr/bin/apt-get update (unauthorized event)

The log contains the recorded time of the event, the name of the machine TpadJ, the user that caused the event juuso and what happened: 1 incorrect password attempt. It also reports the working directory that was used while issuing the command: /home/juuso and the path to the issued command: /usr/bin/apt-get update

  • Sep 2 15:27:30 TpadJ sudo: juuso : TTY=pts/0 ; PWD=/home/juuso ; USER=root ; COMMAND=/usr/bin/less /var/log/auth.log (authorized event)

Here the same things are recorded except the event is authorized so there is no mention of an incorrect password attempt.

  • Sep 2 15:27:30 TpadJ sudo: pam_unix(sudo:session): session opened for user root by (uid=0)

Here the log mentions the start of a sudo session.

Dream apt-get command

The next task was to create the ultimate apt-get command that would install all my favorite programs at once. For me those would be Steam Locomotive, Blender and Steam. The command to install them all would be:

  • sudo apt-get install -y sl blender steam

New Command Line programs

Then the task was to install and try three new programs that work on the command line. I chose to install:

  • tree
  • Browsh
  • htop

commands to install everything:

Browsh

Browsh is a text-base cli browser that can render anything that a modern browser can. It can be used on low power devices and with less good internet connection. Browsh

htop

Htop is a task manager that works in the terminal. It can be used to view memory and cpu usage for processes as well as to shut down processes. htop

tree

Tree is a tool that can be used to view the file tree of the current or specified directory. tree

Links