Why programmers use command line interface?

Status
Not open for further replies.

bearbles2

Newbie
Joined
Oct 10, 2020
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
29
Hello, I'm new to programming (started with C) and I searched this question on web and couldn't find any specific simple explanation (my english isn't the best).
I wonder why programmers use CLI (for which purposes)? Is it necessary to use CLI for being a good programmer? And why always LINUX? I never seen a programmer using windows cmd. I'm windows user so does it mean that i should change my os to linux to be a good programmer?

If i use linux command line does it mean that i do not need an IDE? Or both can be used together? I saw people using text editor rather than IDE and they use linux command line for compiling/debugging etc. Why they do that? What're the advantages?

Thank you everyone!
 

Hi,

What is command line controlled?
Surely no (good) programmer would write it´s C source code via command line.

But to upload a HEX file to a microcontroller (as example) a command line "programmer" could be useful. It simply can be automated. Singley key pres or via hotkey from the IDE.

Klaus
 

Hi;
For C like languages, it is normal I think, because there is not much option to develop graphical user interface when C like languages are common in past.
On the other hand consider embedded programming. Many embedded platforms has no screen, generally you can communicate over uart, ssh etc. Then command line usage is the only option.
Consider remote connections, transferring graphical interface (GUI) over network is not reliable, especially in past when there is not enough upload/download rates. In that case, cli is most convenient way.
And of course for scripting (automating many commands in a singe file and call them sequentially, and just run single script, in windows dos shell/batch files, in linux bash shell)
Eventually, even you use graphical IDE, most probably it is running old cli type programs (such as make, gcc etc) in back ground.

If you plan to be -especially- embedded system developer, I suggest you that, don't hesitate to use cli, be familiar with linux. Start by installing a virtual linux PC, and taste it

I hope, it helps to clarify.
Good luck!
 

The Linux command line set is very extensive, and there are a lot of circumstances on which you can make a lot of tasks with no need of a compiled language. For Windows, the closest they did in the CLI scope is the Power Shell, which for some reason did not took the programmer's adherence.
 
Last edited:

Todays embedded programming mostly uses IDEs like Eclipse or VisualStudio for Code writing, compiling and debugging. Nevertheless some actions can be better performed on the command line., no matter if you use Windows or Linux.
 

Once in a while I type in DOS commands when running utility programs. Sometimes I need to look into a hard disk problem. I have utility CD's (such as the Emergency Boot CD, Ultimate Boot CD, PC Wizard, etc). Navigation frequently drops into DOS when a program is done.

Commands which I try not to forget:

HELP (name of program)

TYPE (to examine autoexec.bat or config.sys)

DIR (with switches /a /w) (to see every file and to check for presence of io.sys and msdos.sys)

c:

cd..
 

I use Linux exclusively but occasionally have to use Windows on other peoples machines. I would say that for most programming and debugging of other devices (MCU etc) I use an IDE but for basic operating system code I use CLI or more specifically script files.

For example, I have a utility written in a text editor and saved as a script that scans for all devices on my network (typically 20 to 25 devices) and reports their IP addresses, MAC numbers and the device name. It would take a fairly big program to do that as an exe file but my script only uses 514 bytes and some of that is comments!

Brian.
 

Don't forget that most GUIs that control other programs end up creating the CLI and passing that to the other program.
In the case of an IDE, the code editing may be done within the IDE but the compiler is not (normally) built in and so it needs to be activated by the command line. You just don't see that as the IDE also reads the error information and interprets that back into the source for you.
As others have said, compilers typically have a huge number of command line options and having the IDE handle most of those for you is a blessing. Also the IDEs that I've used normally have a way to add your own options that are passed to the compiler (or linker or whatever)along wth those that are generated by the IDE.
Susan
 

In Linux, there are simply hardly any usable GUIs.
Therefore, a lot of Pascal, FreePascal or Lazarus Pascal is programmed under Linux.
I even think that more programming is done in Pascal under Linux than under Windows.
Under Windows MS Visual C and C++ exist.
The easiest and best alternative under Linux is Lazarus Pascal.
As I said, many Linux programs are written in Pascal, but hardly anyone knows that
Just google for it
 

I've never had a problem with GUI environments in Linux and at least for the past 10 years or so the majority of Linux programs have been written in Python or C/C++.

It is true what Susan said, much of the underlying work is done by CLI driven programs with the GUI just acting as a friendly face for them. The GUI creates suitable command lines and passes them to the CLI interface to get the work done. Command line programs are actually far more versatile and work like building bricks, each alone has limited use but put them together and you can build house, bridges, skyscrapers...

Brian.
 

Just easy tasks with output files and report filtering is much more easier on LINUX terminal. You can do everything and flexilbility is the best
 

6 months late, but I love this question.

Is it necessary to use CLI for being a good programmer?
Yes. One of those important skills in software is being able to debug. And when I say debugger I'm not talking about using an IDE debugger tool for your program, I'm talking about Friday afternoon at 4 PM and your distribution warehouse calls and asks you why it just received a request from your e-commerce platform to ship 500 orders of something called ActiveRecord to a place called localhost. You're gonna need the command line to dig into these things.

And why always LINUX?
There are a lot of reasons for this and they'll become clear as you advance in programming. The most significant to me are it's ubiquity in servers/embedded software, and being open source at its core. Linux is the operating system most servers that back web applications, embedded systems, and IoT devices run on. Many of the programs running on these machines are comprised of open source software, which is a core element of Linux. The license used by the Linux kernel (GPL) basically allows it to be used, modified, copied, other stuff, without needing to obtain permission or pay for a license. Remember that at the end of the day, Windows is a product. Linux is a project.

should I change my os to linux to be a good programmer?
Yes

If i use linux command line does it mean that i do not need an IDE? Or both can be used together?
Yes. You can almost always find the underlying commands needed to get your work done, but there are definitely situations where a specific IDE is helpful. Android/Android studio is a good example of this.

I saw people using text editor rather than IDE and they use linux command line for compiling/debugging etc. Why they do that? What're the advantages?
Similar to my answer to your first question, but with the addition that using the command line will force you to gain a deeper understanding of the entire system that you're trying to build. It exposes the underlying functions that are generally hidden my the features of an IDE, and the skills on the command line translate across lots of a much broader spectrum of software/computer skills. IDEs tend to be more specific, because like Windows, they are products. You will never open Vim and be greeted by a pop-up asking you to go 'Visit the Blog' or anything like that.
 

should I change my os to linux to be a good programmer?
no, really not
 

Isn't CLI mostly used to directly communicate with the hardware?
 

Hi,

In my eyes "command line" is not related to "hardware".
There are even command line text editors.

Klaus
 

Ohk, I have little reading about Assembly language so I just posted.
Many times network professionals used only command prompt to directly communicate with the kernel.
Apologize for any kind of my misunderstanding.
 

Hi,

I don't understand why you talk about "assembly language" now.
How does it relate?

Klaus
 

Isn't CLI mostly used to directly communicate with the hardware?

In the DOS days we had to navigate by CLI to open the 'autoexec.bat' and 'config.sys' files, if we wished to edit their command structure. These are instructions to the computer at startup as to hardware assignments (such as extended memory, expanded memory, external disk drives, etc.) Also instructions to run an application using certain parameters and switches.

Nowadays Windows gives us an easier time (via Device Manager) to inspect hardware settings, driver details, disk usage, etc. To install and uninstall drivers, etc.
I think it's an impossible job to use a CLI to navigate among numerous WinOS folders to do the same.
 
Reactions: Emic89

    Emic89

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…