Brief introduction about Linux for newbies

Sean
NTUST-AIVC
Published in
6 min readMar 10, 2022

Co-Author: Y. S. Huang, a master’s student studying AIVC, likes open-source.
If you are interested, go to check my Github!

History of Linux

Linux is derived from UNIX. Linux also follows the GNU General Public License. I will list two significant points below the line:

Open source:
Software that follows GPL is open source. Their code would be released in public and can be varied by everyone.

Copyleft:
If a distribution of operating system is a descendant of the one which follows GPL, it will also follow the GPL.

As I have referred, Linux is open-source software. Because everyone can vary the source code, the whole Linux system can progress very fast. Also because of that, Linux has released a lot of versions. We called those Linux distributions.

Linux distribution
Linux distribution is a version of the open-source Linux system packaged with some programs, tools, additional software. There are hundreds of Linux distributions today. Popular distributions include Fedora Linux, Red Hat Enterprise, Debian, Ubuntu.

Later, I will talk about apt command which is a main command-line package manager for Debian and its derivatives. Why can we use the apt command in Ubuntu? That’s because Ubuntu is a successful and very popular derivative of Debian.

Advanced Package Tool (apt)

Apt ( Advanced Package Tool ) is the command-line tool to interact with the packaging system Debian-based Linux distributions. There are several functions you can use in apt command including installing new packages, updating packages, upgrading packages, and removing packages.

apt vs apt-get
Apt command was released in 2014. It have most of functions in apt-get and apt-cache. Currently, most of distributions recommend users to use apt command instead of apt-get because apt deprecated some low-level and seldom used functions. It collected most widely used features and unified some functions as one. If you still need some specific functions to manage your packet, there’s no problem to use apt-get command. It’s still functional.
There are some commands that replace the apt-get commands down below:

There is something new in apt :

Currently, apt is more popular to use than apt-get.

Functions in apt command

Installing packages

$ sudo apt install <package_name>

The command will retrieve and install the package from apt repositories. When the user installs a new package, apt will show the dependency of the package and simultaneously download other necessary packages.

Update package database

$ sudo apt update

I want to introduce you to the PPA first. PPA is called Personal Package Archive. It saves some URLs about the packages. Those URLs refer to the newest version website of every package. When you use the command $ apt update , the system will download the package information from PPA. Then the system can find the newest version of every package listed in PPA.

Upgrade package

$ sudo apt upgrade

By means of using this command, the system will download the newest version of packages listed in PPA and upgrade.

Remove installed packages

$ sudo apt remove <package_name>

This command will help users remove the package which has been installed.

Remove useless packages in the system

$ sudo apt autoremove

When you remove a package, there may exist some redundant packages which are no longer needed. This command sweeps those useless packages out and helps you tide up your disk.

Some useful commands in the UNIX/Linux CLI

sudo (“super user do” or “ substitute user do “)

This command will first check the password of the user to ensure the operator. After being reviewed, the user can access the privilege of the root to run a certain command.

$ sudo <any command>

The file, /etc/sudoers, specifies who can use sudo but I do not recommend modifying the file to manage sudo permissions.

cd (change directory)

cd is used to change the current working directory. It can go with some extra symbols:

ls (list the content of the directory)

About ll is a little bit confusing about the information it gives us, so let’s dig into it!

Column 1: permission of the file or directory.

The first letter shows the type of the file.
d : directory.
: file.
The later 9 letters show the attribute of the file. Every 3 letters as a group.
1st group: permission of the owner
2nd group: permission of the user who is in the same group as the owner
3rd group: permission of the user who is in the group that is different from
owner

It will show three words, r , w , x . These words imply different meaning respectively.
r : read permission
w : write permission
x : execute permission

Column 2: Number of nodes linked to the file
Columns 3 & 4: Owner and the group of the file
Column 5: Size of the file. Use byte as its unit.
Columns 6 & 7 & 8: The last time user modified the file.
Column 9: The name of the file

cat (concatenate)

It reads data from the file and gives its content as output.

$ cat <path/filename>

grep (globally search a regular expression and print)

It can search the keyword in the file.

$ grep <keyword> <path/filename>

It also can be used with the pipeline | to use the former command’s output as the object which will be searched.

$ cat <path/filename> | grep "<keyword>"

mv (move)

It can move files to other directories.

$ mv <target_file_or_dir> <the_dir_move_in>

mv is also can rename the file or directory.

$ mv <oringal_name> <new_name> 

NOTE: Make sure there are not any files with the name that you want to rename in the directory.

Filesystem Hierarchy Standard

/ -Root

The disk is mounted at the point. Every file and directory belongs to the root. Only the root user has the privilege to go through this directory.

/usr/ -User programs

Contain user programs and data such as bin, lib, man, local……

/bin/ -User Binaries

Contain binary executables and commands used by all the users.

If you want to see more details, you can go check the link down below:

--

--