A Brief History of Linux:

A popular open-source operating system is Linux. It was initially created by Linus Torvalds in 1991. At the time, Torvalds was a computer science student at the University of Helsinki, Finland and began working on the Linux project as a personal endeavour. The name Linux is a combination of his first name, Linus, and Unix, the operating system that inspired his projects. At the time, most operating systems were proprietary and expensive. Torvalds wanted to create an operating system that was freely available to anyone who wanted to use the operating system, He originally released Linux as free software under the GNU General Public License. This meant that anyone could use, modify, and redistribute his source code.

Early versions of Linux were primarily used by technology enthusiasts and software developers, but over time it has grown in popularity and is used in various types of devices such as servers, smartphones, and embedded systems. Linux is considered one of the most stable, secure and reliable operating systems and is widely used in servers, supercomputers and enterprise environments. Today, Linux is one of the most widely used operating systems in the world, with an estimated 2.76% of all desktop computers and more than 90% of the world’s top supercomputers running on Linux, and approx. 71.85% of all mobile devices run on Android, which is, you guessed it, Linux-based. The Linux community has expanded to include thousands of developers and users who work on the creation and upkeep of the operating system.

Why Linux?

Linux is one of the most popular versions of the UNIX operating System. It is open source as its source code is freely available. It is free to use. Linux was designed considering UNIX compatibility. Its functionality list is quite similar to that of UNIX.

Basic Features:

Following are some of the important features of the Linux Operating System.

Portable − Portability means software can work on different types of hardware in the same way. Linux kernel and application programs support their installation on any kind of hardware platform.

Open Source − Linux source code is freely available and it is a community based development project. Multiple teams work in collaboration to enhance the capability of the Linux operating system and it is continuously evolving.

Multi-User − Linux is a multi user system that means multiple users can access system resources like memory/ ram/ application programs at same time.

Multi-programming − Linux is a multi-programming system that means multiple applications can run at same time.

Hierarchical File System − Linux provides a standard file structure in which system files/ user files are arranged.

Shell − Linux provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, called application programs. Etc.

Security − Linux provides user security using authentication features like password protection/ controlled access to specific files/ encryption of data.

Now that we have a brief understanding of Linux’s history, let’s dive into some basic Linux commands that every user should know.

Introduction to Basic Linux Commands:

Now that we have a brief understanding of Linux’s history, let’s delve into some fundamental Linux commands that every user should know.

1. ls – List directory contents

$ ls
Desktop  Documents  Downloads  Pictures  Videos

2. pwd – Print working directory

$ pwd
/home/genexdbs

3. cd – change directory

In $ pwd
/home/genexdbs

Change to the directory Documents
$ cd Documents

Now in pwd,
$ pwd
/home/genexdbs/Documents

4. mkdir – make directories

Before creating a new directory
$ ls
Desktop  Documents  Downloads  Pictures  Videos

$ mkdir Tutorials
Now new directory Tutorials is created

After creating the new directory Tutorials
$ ls
Desktop  Documents  Downloads  Pictures  Videos  Tutorials

5. touch – Create an empty file

$ touch db1.txt

Now the new file db1.txt is created
$ ls
Desktop  Documents  Downloads  Pictures  Videos Tutorials db1.txt

6. rmdir – Remove empty directories

$ ls
Desktop  Documents  Downloads  Pictures  Videos Tutorials db1.txt

$ rmdir Tutorials

Now Tutorials directory was removed
$ ls
Desktop  Documents  Downloads  Pictures  Videos  db1.txt

7. rm – Remove files

$ ls
Desktop  Documents  Downloads  Pictures  Videos  db1.txt

$ rm db1.txt
Now the file db1.txt is removed

$ ls
Desktop  Documents  Downloads  Pictures  Videos

8. cp – Copy files or directories

$ ls
Desktop  Documents  Downloads  Pictures  Videos  file1.txt

$ cp file1.txt file2.txt

After copying file2.txt
$ ls
Desktop  Documents  Downloads  Pictures  Videos file1.txt  file2.txt

9. mv – Move or rename files or directories

$ ls
Desktop  Documents  Downloads  Pictures  Videos file1.txt  file2.txt

$ mv file1.txt newfile.txt

After moving or renaming files
$ ls
Desktop  Documents  Downloads  Pictures  Videos newfile.txt  file2.txt

10. cat – Concatenate and display file content

$ cat file2.txt
Hello, World!
Hi
Nice

11. less – View file content one screen at a time

$ less file2.txt

12. head – displays the first 2 lines of the file

$ head -n 2 file2.txt
Hello, World!
Hi

13. tail – it displays the last 2 lines of the file

$ tail -n 2 file2.txt
Hi
Nice

14. grep – Print lines matching a pattern

$ grep "Hello" file2.txt
Hello, world!

15. find – Search for files in a directory hierarchy

$ find . -name "file2.txt"
./Documents/file2.txt

16. chmod – Change file modes or Access Control Lists

$ chmod 755 script.sh

$ls -lrth
-rwxr-xr-x  1 genexdbs genexdbs    0 Jul 17 12:22  script.sh

17. chown – Change file owner and group

$ chown root:root script.sh

$ls -lrth
-rwxr-xr-x  1 root root    0 Jul 17 12:25  script.sh

18. df – Report file system disk space usage

$ df -h
Filesystem  Size  Used  Avail  Use%  Mounted on
/dev/sda1    50G  20G    30G   40%    /

19. du – Estimate file space usage

$ du -sh *
10M Documents
20M Downloads

20. top – Display Linux tasks

$ top
top - 13:42:36 up  2:26,  1 user,  load average: 0.85, 0.75, 0.69
Tasks: 469 total,   1 running, 468 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.7 us,  0.7 sy,  0.0 ni, 97.2 id,  0.4 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :  15688.6 total,   2756.7 free,   7706.9 used,   5225.0 buff/cache
MiB Swap:   2048.0 total,   2048.0 free,      0.0 used.   6833.6 avail Mem 

PID     USER     PR NI VIRT     RES    SHR   S  %CPU  %MEM  TIME+    COMMAND                                                                                                                             
91896  systemd+  20 0  1650132  73560  17284 S  5.0   0.5   0:00.09  mysqld                                                                                                                              
2047   elastic+  20 0  7067592  1.5g   28480 S  0.6   9.8   1:50.82  java

21. exit – closes the terminal

$ exit

22. kill – To terminate a process using its Process ID (PID)

$ kill 2047

23. wget – Non-interactive network downloader

$ wget http://example.com/file.txt

24. curl – Transfer data from or to a server

$ curl http://example.com

25. nano – Simple text editor

$ nano file.txt

26. vim – Advanced text editor

$ vim file.txt

27. ssh – OpenSSH SSH client (remote login program)

$ ssh user@hostname

Example:
If you want to connect to a remote machine with the IP address 192.**.**.12, and the username on that machine is genexdbs.
$ ssh genexdbs@192.**.**.12

28. scp – Secure copy (remote file copy program)

$ scp file.txt user@hostname:/path/to/destination

Example:
If you have a file named file.txt on your local machine, and you want to copy it to a directory /home/user/documents on a remote machine with the IP address 192.**.**.12, using the username genexdbs.

$ scp file.txt genexdbs@192.**.**.12:/home/user/documents

29. date – Displays today’s date with time

$ date
Monday 15 July 2024 02:17:34 PM IST

30. zip – Package and compress (archive) files

$ zip archive.zip file1.txt file2.txt

These commands form the foundation of basic Linux operations. Mastering them will significantly enhance your ability to navigate and manage a Linux system efficiently. See you all in the next level of Linux commands till that happy learning!

Discover more from Genexdbs

Subscribe now to keep reading and get access to the full archive.

Continue reading