Do you know which operating system is the most popular in the world? It is Linux! It generally runs on servers and supercomputers, and the millions of servers behind the websites we access daily are likely running Linux. In this article, we will learn what Linux is, where it comes from, commonly used Linux knowledge, and the commands you need to navigate this exciting platform.
1
Learning to use the Linux system is a great opportunity to familiarize yourself with the command line, which is the most straightforward way to communicate with a computer. Additionally, as you try different projects, you will learn about software repositories, package management, file permissions, user management, and more. If you have experience with npm and GitHub, then package management and software repositories may already be familiar concepts to you.
2
-
Linux is free. You don’t have to pay to use Linux; you can freely view, edit, and distribute the source code. When you buy a computer with Windows or macOS, the cost of those operating systems is already included in the price.
-
Linux is flexible. Linux is used in many different types of computers, including smart toasters and refrigerators, other IoT devices, internet routers, Android smartphones, and more. You can install Linux on your laptop or desktop right now without any setup required to get it up and running! This flexibility is made possible because the Linux operating system is designed to be simple for basic tasks while also having more advanced tools available. You can assemble a version of Linux customized for your device and optimized for your needs.
3
Linux is a “Unix-like” operating system, which means that most of its features are derived from Unix and generally follow Unix design principles. An ideal Unix program is simple, modular, and extensible. Unix programs do well at accomplishing specific tasks and are designed to work well with other programs without relying too heavily on them. The system becomes powerful by leveraging the collaboration of programs rather than because any single program is super powerful.
One of my favorite things about Linux is that everything is a file. The commands and programs you run in the terminal are abstracted as files. The desktop icons used to quickly open your favorite applications are also abstracted as files. How does the system check for application updates? That’s written in files too. Everything that could lead to confusion can be resolved with files. Linux is transparent, dynamic, and elegant. You can imagine being able to customize your Linux installer while having complete control over the system, getting rid of what you don’t want, which is really cool!
These principles accurately illustrate the flexibility of Linux. No wonder it is used in many applications.
4
Next, I will show you a typical system tree or file system hierarchy in Linux. You can read more about tree data structures in my other articles (https://dev.to/emtes/learning-data-structures-trees-2p5g). If you operate on your own Linux system, your directories may not be exactly the same as mine, and may have more or fewer directories. If you want to learn more about these directories (folders), type man hier in the Linux terminal and run the command to read the manual. Personally, I like to keep a search engine nearby to look up new names whose meanings I don’t know.
5
I mentioned earlier that “the most straightforward way to communicate with a Linux machine is through the command line,” and I mean it. Next, let’s start learning some basic command line or terminal commands that will get you familiar with the system. If you are currently developing using a graphical user interface, you may find it faster and safer to perform operations from the terminal once you become familiar with the command line.
You have a program called shell (think of it as the shell surrounding the operating system kernel) between you and the terminal. The shell is the program that interprets text commands and sends them to the operating system for execution. The most common shell program is Bash, which is included in most Linux distributions. For macOS users, Apple recently switched macOS’s shell program to zsh. macOS is also a Unix-like operating system. Of course, you can change the shell at will!
6
Since the article has already covered enough, I won’t share too many commands in this article; note that the learning mode is more important. Typically, terminal commands follow a very similar and predictable structure:
program_name [–optional flags] [optional arguments]
Flags can appear after the arguments and are typically shortened to a letter and a dash, such as -f. Flags are options that change how the program behaves. For example, -h or –help are commonly used help flags that provide information about which flags are available for use when the program receives that flag.
Arguments are usually files, but they can also be strings and numbers.
You can call programs from any directory in the system, and you can use files from any directory in the system as arguments. You can do this because you can use relative or absolute paths to name files in Linux. A relative path is relative to the current directory, and you can use . to represent the current directory (which will be explained further below). An absolute path starts from the system’s root directory /, and you need to specify each level of directories to get to the desired file.
7
-
pwd prints your current directory (print working directory)
-
cd changes the directory to the specified argument (changes directory). If no argument is provided, it defaults to the user directory, and you can also use ~ in the path to jump. . and .. represent the current directory and parent directory, respectively, and are also valid arguments for the cd command.
-
ls lists the files in the specified argument directory (list), with the default argument being the current directory, i.e., .. The -a flag can conveniently view hidden files. In Linux, you can hide files by naming them with a . at the start, as in .gitignore.
ls -a ~/Documents
8
-
mv moves a file or directory to the specified directory (move).
mv fun-letter.text ~/Documents/letters/
mv fun-letter.txt hilarious-letter.txt
-
cp copies files in the specified directory (copy). Use the -r flag to recursively copy directories, and like using mv to rename files, you can use a similar method to rename files and directories. -
mkdir creates a new directory, with the new directory name as an argument. You can also use the -p flag to create new directories under non-existent directories.
mkdir -p code/web-stuff/html notes
-
touch creates a new file, with the file name as an argument.
8
I won’t say that 2020 will be the year of Linux on the desktop world, but I want to share that many Linux distributions have been able to work out of the box, and we can install them very easily. If you are attracted by the capabilities of the Shell or are concerned about privacy risks posed by using other operating systems, or simply enjoy hacking and other technical aspects, then Linux is perfect for you. As a developer, it is also a great platform because it is designed with other developers in mind. Linux distributions (such as Ubuntu, Linux Mint, and Fedora) can boot up and run quickly. These distributions have huge community support, and community members are very willing to help others. Lastly, I want to remind you to remember to back up all important files!
What are the Features of SEGGER’s Three RTOS?
How Keil MDK Stores Variables at Specified Memory Addresses
A Few Excellent Online Compilers Supporting C, C++, and More
Long pressto go to the public account in the imageto follow
Leave a Comment
Your email address will not be published. Required fields are marked *