Before we dive into Linux basic commands, lets us know what is Linux. Linux is based on a well known open-source operating system called UNIX. It was developed in the late 70s at Bell Labs by Dennis Ritchie, Ken Thompson, and others. From your smartphone to laptops, servers, Smart Tv, and home appliances, Linux can be found everywhere. In 1991, Linus Torvalds’s early student at the University of Helsinki created Linux.
Linus Torvalds builds Linux as an open-source Operating system. So anyone has the freedom to modify the program and run for any purpose. The Linux kernel is written in C programming language and assembly language and few other programming languages. If you interest to learn more about Linux kernel, kernelnewbies.org would be a great place to start.
What is Kernel ?
The Kernal is the heart of Linux OS. So what is a kernel? you might think. The kernel is a core component of OS that is responsible for a low-level task such as processor management, memory management, and Disk management. Whenever you turn on your device, the Kernal is the first program that loads up to your main memory. And it remains until you turn off your device.
Since Kernal hangs on the main memory, it is vital that the kernel should be as small as possible while providing the services that require to keep the system running. As Kernel is a core of the Operating system, the kernel loads to a protected area in the main memory. As a result, it prevents overwriting the kernel by the programs which run on the system. One of the main advantages in Linux is that the programmers can access the kernel in order to design there own OS.
What is “distribution” ?
So what is distribution? The Linux Versions are called as Distribution or else in short “distros”. There are hundreds of different Linux versions out there. Every version is developed for a specific target such as smartphones, Servers, desktop computers, laptops, or else embedded devices.
- LINUX MINT
- ELEMENTARY OS
What is “Terminal” or Shell?
A Shell or a Terminal is a computer program that takes instructions from the user through a Keyboard. Typically, a shell takes commands from the user and passes it to the operating system to process. Based on the input, the output can be varied. Normally the distros come in GUI (Graphical User Interface). However, Linux has its own CLI (Command Line Interface). To open terminal windows in Ubuntu, press Ctrl + Alt+T on your keyboard. In fact, you could control your compute through CLI instead of using GUI.
Before we dive into Linux basic commands, let us understand what is shell,
Basic Linux commands
- Pwd: once you open the shell, you are working in the home directory of the user. By entering the pwd command, you can simply print the current directory that you are working on. According to the given example, the entire path ie printed as /home/knight. In that case, the path starts from the root and the forward-slash( / ) is denoted as root. Which means the absolute path of the Linux file system.
[[email protected] ~]$ pwd
NOTE! The command is case-sensitive. If you enter, “PWD” you will get an error message.
- ls: This is a Linux basic command that used to print the files and directories in the current folder. however, the ls command can be used with other parameters to find hidden directories, and short according to the date and time.
[[email protected] ~]$ ls
In fact, we could combine the ls command with -al ” ls -al ” to view all hidden files. This allows us to list the hidden files alone with their permission, owner, group, date created, and file type.
[[email protected] ~]$ ls -al
- Mkdir: To create a directory, Linux uses the command mkdir -v <directory_name>. The -v between mkdir and <directory name> represents the verbose.
[[email protected] ~]$ mkdir -v newfolder
- –P: In Linux, the higher directory is parent directories. To create a parent directory, type the command we use “mkdir” alone with “-p” mkdir -p <folder1/folder2/folder3>“.
[[email protected] ~]$ mkdir -p folder1/folder2/folder3
- rmdir: If the file is not empty, we could use the command “rmdir -v <directory_name“> to remove. In addition, we add “-v ” to show the result.
[[email protected] ~]$ mkdir -v learn
- rm -rf: We use the “rm” alone with “-rf ” and directory name to delete files and folder that exist in the directory.
[[email protected] ~]$ rm -rf newfolder1
- touch: To create a file, we use the “touch” command alone with filename.
[[email protected] ~]$ touch this_is_empty