Yes. It is preferred especially in Unix -based OSes like Linux (and sometimes Mac) and mainly for system administration on Windows-based systems and Active Directory. It is somewhat more secure for Unix systems because using the root user sudo requires authentication as a step to prevent abuse of power (aka run as administrator on windows without the password). In addition, several tasks can be run alongside each other. Here is an article that may be useful.
For data scientist, if you are not dealing with Linux, you will probably use it to install packages via pip or conda. You may also encounter it when using git, but personally I’m just lazy and use Team Explorer in Visual Studio or connect VSCode with Github Desktop. Ultimately its up to your preference but sometimes it may be advantageous.
This depends on the scenario. If you accidentally created a file, you can simply remove it using rm, or remove/uninstall package name etc. Other times when you realised you made a mistake, you can use Ctrl-C to halt the process. Of course there are instances where the damage is more permanent - and where you would have to seek help or troubleshoot errors.
Here are some topics I made that you might find useful regarding the command line:
You can call multiple commands automatically on a command line.
One example is looping the same command with a different input variable (eg. grepped list of filenames).
To do that in UI you may have to sit at the computer and wait for 1st file processing to be done then repeat the 1. open file, 2. process procedure 100x instead of sending 1 command and walk away for 1hr
You can pipe commands in command line. In UI you may have to save a file after 1 processing command, then open the file manually for the 2nd command
You can do && and || logic between commands to control whether subsequent commands run based on success/failure (exit codes) of previous commands
There are too many available commands and options, devs got no time to create a million buttons on front end for you to click, thus hidden capabilities exist in cli that’s not available on UI (eg. Increasing disk size of google cloud VM after it’s been started)
You can get the best of both worlds at times. VLC player lets you click around then generates the command line version to achieve the same for 1 file, you can then wrap it in a loop to process media files repeatedly.
Sure i always prefer UI if it’s available (VSCode gitlens, test discovery and other extensions/built-ins), but for control flow and specifying exactly how something is to be done, command line has to be used. UI just provides a subset of the capabilities of command line, it is designed to save time for common operations, once you know how to do it the command line way.
Hi! I’m not that experienced as @hanqi and @masterryan.prof but I’d like to share my recent discovery about how powerful the command line is. I’m working on a personal project now and I had to do some previous data treatment to be able to process it later with pandas. I had 153 files that contained over than 5 million lines. Each line was wrapped into quotes that I had to remove. One command in the command line and a glob pattern to match all the files needed had all the job done in less than 3 minutes. Just look how elegant it is: