What is Linux?
Linux is an Operation System (just like Mac OS or Windows). It is free and open-source which means you can contribute to it. (Yaaay ^^)
Linux has distributions. But what is a Linux Distribution?
A Linux distribution is an operating system built on the Linux kernel. Think of them as different flavors in an ice cream truck. You can choose the one that suits your taste.
Now that we mentioned it, what is the Kernel?
The kernel is the core part of the operating system. It acts as a bridge between hardware and software, managing communication between them.
In Linux, we can interact with the operating system in two ways:
- GUI is where we use the mouse to click on buttons, icons (and etc.) to complete tasks.
- CLI is where we type commands in the terminal to perform tasks.
Now, hopefully, assuming most of us already know how to use the GUI, we can move on to learning…
…Linux commands.
Let`s start with the things we already learned, such as the kernel.
Command: Uname
For getting information about our system, we have the command uname. It prints kernel name, version, architecture, and hostname.
There are a bunch of useful commands related to the system.
-
uptimeshows how long the system has been running. -
whoamishows our current user. -
top showsrunning processes and system usage. -
htopis improved version of top. -
free -hshows memory usage. -
df -hshows disk space usage.
Command: hostname
If it is not already obvious from the command itself, this is for checking our hostname (which is ubuntu). But how can we change the hostname? We can do it with sudo hostnamectl set-hostname new-hostname command. Make sure to use sudo if you are not already root.
Now, what is sudo and why do we need it?
sudo means we are running a command with root access. In Linux (unlike win admin), root is the main user with full control over the system and can do literally anything. So when we put sudo in front of a command, we are running that command with root privileges for that moment.
Command: pwd
Now let`s see our path by pwd command.
Since we talk about paths. It is good to know about two types of paths:
Absolute Path and Relative Path
An absolute path is the full location of a file or directory, starting from the root directory /. It never changes because this path works from anywhere on the system.
A relative path shows the location of a file or directory based on the current directory, not from the root /. If you change your location, the path will change.
We can think of it as an address on a piece of paper. Let’s say we want to find the way from our home to the rabbit hole. The full (absolute) path is /home/farm/garden/tree/rabbit-hole. No matter where we are this won’t change.
But now imagine we are already somewhere inside the farm. We ask a caterpillar if he knows the way. He says “garden/tree/rabbit-hole”. This is a relative path.
We walk some more and reach the garden. Then we ask the Cheshire Cat again, and he says “tree/rabbit-hole”. Now the path has changed because we are in the garden. This is how relative path works. It depends on our current location (where we are now).
Command: mkdir
We can create a folder there. Type mkdir directory_name.
To delete the folder: rmdir example_folder or rm -rf example_folder.
Command: ls
How to see what we created? ls command lists files in a directory.
You can add some flags (options) to the command ls. Such as:
-
ls -a(show all files including hidden ones) -
ls -l(long format listing)
Command: alias
How about we try to command ll? Normally, it is alias for ls -l, but since our Linux is Ubuntu default, it is ls -alf (which includes all hidden files, long detailed formats and symbols like / for directories).
So, what is alias? It is a shortcut for a longer command. Such as ll. The structure is simple. alias shortcut='full_command'
Command: cd
In Linux we have cd command for navigation.
We used cd to move to the example_directory. In order to return, we type cd .. command.
Command: touch
Let's say we want to create a file in this directory. There are several ways to do this basic task, however we will start with the easiest: The command touch.
To delete the file: rm file_name.txt or rm -rf file_name.txt
Warning: rm -rf /* deletes your entire system.
Text editors
The other way to create a file is using one of the text editors in Linux. Nano, Vim (Vi Improved) or Vi (old).
Command: Cat ฅ^>⩊<^ ฅ
We can also check out what is inside our files by cat command.
With cat command we can more than that. What if we check a system file that contains details about our Linux distro?
We can also create a file with cat command and > symbol.
Command: grep
If we want to search for a specific word inside a file, we can use the grep command.
Another way to use grep is by combining it with the cat command.
The | (pipe) operator allows us to pass the output of one command (cat) as input to another command (grep).
Command: echo
Another way of creating a file is using echo command.
Normally, echo will print text to the terminal.
We can also print variables but do not forget the symbol $.
Lastly, we have cp and mv commands.
-
cpcommand copies a file or directory to another location.
-
mvchanges the location of a file or directory.
A question for you!!! (〃 ̄ω ̄〃ゞ
What is the difference between mv and cp that you have encountered?



























Top comments (0)