Can i say shell is a feature of the CLI,it is command line interpreter?
Without any shell we have many problems but it is possible to work with OS. For example instead of ls
i should use /usr/bin/ls /full/path/to/current/place/
Without CLI it is not possible because users have not any interface to speak to kernel for doing their jobs?
Please explain difference between shell and CLI for answering this question
The "shell" in your sense, I think, is considered the interface by which you interact with your machine, whether it be a terminal, a graphical interface, or some direct brain-to-machine link. More accurately, one could say that the "shell" is the program (
sh
,bash
, X11, Gnome, KDE, BrainLink 3.2, whatever) that interfaces with the hardware in order to allow you to interact with your machine.Meanwhile, the CLI (or the Command Line Interface) is a type of shell that allows you to access the system's command line (hence the word interface).
As you've discovered, not all shells are built the same. Some offer graphics (like X11/Unity), while some are only terminal access, like your average TTY. Even within this, these shells can differ because of the program running them. For example, the
/bin/sh
shell is relatively simple and offers a basic CLI, while/bin/bash
offers far more capability. Both are still technically shells, as is some very simple program that just callsexec()
on whatever you pass it.Even without a CLI, your system can still be 100% useful. Take Windows or macOS for example. Neither of these really demand a CLI (and I'm sure they would remove it completely if they could), but the system is still very much usable.
Keeping this in mind, though, every system has a command line available, but not every system has a command line interface open for you to use. On the flip side, a shell (graphical or console) is necessary for you to be able to interface with your machine in order to run arbitrary programs. For example, your Linux-based smart TV is technically a "shell" as it can launch arbitrary apps, but your parking meter also running embedded Linux has no such need for a publicly-facing (or even private-facing) shell.
Interface vs Shell
There is a lot of confusion about what is Command Line Interface and what is Shell. As has been mentioned in the comments, whatever has "interface" word in it, is idea or theory. When you hear the word "interface" , think "idea for communication with computer". Interface can be between two computers, like Ethernet cable, but also between computer and user.
Shell is that theory put to practice. CLI says user interacts with computer via text, and shell does exactly that. Graphic User Interface says "user interacts via buttons and icons", and GNOME or Unity provide that. A shell is actuall piece of software, some object that user can use to interact with computer. "Interface" just poses idea of how that interaction should happen.Nowadays , they are used interchangeably and "CLI" and "Shell" became synonymous.
Back in the day, when computers were using rolls of paper to print out information, command line interface was the only idea. See for instance this video: https://www.youtube.com/watch?v=qv5b1Xowxdk Sure there's no shell like bash or ksh, but there is minimal shell that reads user commands and processes them.
What happens without CLI and shell?
Think about this for a second: Why do we need shell ? For user interaction! What about times where there is no need for user interaction ? Then there is no need for shell. A great example of that are washing machines, wireless printers, coffee makers. Those devices already run Linux kernel, but there's no need for interacting with user via text. We need to sense button presses and pressure and voltage changes. So there's no need for shell/command-line interface. However , it is still possible to obtain it via clever engineering/hacking techniques : https://www.youtube.com/watch?v=h5PRvBpLuJs
Think about microcontroller chips. I've worked with PIC18 chips for example. These guys just sit on their circuit board and forever run C code. There's no real need to read commands. But for my project I've connected that chip with Raspberry Pi, and was sending text characters like A,B,C to it. That's user interaction ! You could argue that this is minimal shell to communicate with the device.
Communication without shell
Techically, when you use shell, you are not communicating with kernel directly. Shell may be making system calls on your behalf. In theory you could communicate with kernel by compiling and inserting kernel module in C without ever using shell, but that would be highly inefficient and time consuming.
Shell is a function often used by programmers to call an external program from within their application. The same program can often be typed in at that the CLI. When doing this it can be referred to as "shelling out". Output from the external program is usually redirected to a work file that the calling program opens when the "shelled" program completes.
A simple scenario I use daily is from within Libre Office Calc to run a hundred bash commands and store output in the spreadsheet.