Jump to content

[SOLVED] Command Line General Inquiry


Ninjakreborn

Recommended Posts

Is thorough command line the backbone of programming languages.  Meaning if one knows command line properly, they have far greate power than any user that does not?

I am asking because I have noticed generally everything is easier via command line.

Mysql controlling is easier through command line (loading databases), starting, stopping and restarting apache is easier using command line.

Does anyone know of good tutorials that are more "Basic" that are related to command line.  For example how to open a file in command line, how to delete 1 file in command line, safety precautions to prevent you from destroying your computer because of not knowing how to properly wield the power known as command line.  Thanks for the advice.

Link to comment
Share on other sites

Is thorough command line the backbone of programming languages.

No.

 

Meaning if one knows command line properly, they have far greate power than any user that does not?

You might be able to do things faster and therefore more efficiently, but you do not have any sort of power.

 

Does anyone know of good tutorials that are more "Basic" that are related to command line. For example how to open a file in command line, how to delete 1 file in command line, safety precautions to prevent you from destroying your computer because of not knowing how to properly wield the power known as command line. Thanks for the advice.

Which CLI are you referring to? I suppose you mean Linux. You cannot open a file using the CLI, but you can run a program which will open the file. E.g.

$ vim some_file.txt
$ nano some_file.txt

 

To delete a file/folder you'll use rm. This takes various flags which you can see by running

$ man rm

(you can most likely see a manual page for something by typing man <whatever>, e.g. man ls, man mkdir etc.)

 

There are various things you should take care of to not wreck your computer. E.g. don't be root when you don't need to, watch out when using the -r (recursive) and -f (force) flags with rm.

 

 

You can take a look at this. I haven't read it, but it was the first result for "bash scripting" on Google.

Link to comment
Share on other sites

You can take a look at this. I haven't read it, but it was the first result for "bash scripting" on Google.

 

TLDP's bash scripting guide is exactly what I was going to recommend. However, I recommend the introduction guide before the advanced guide - http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html.

 

And if that's even too much, try http://www.ee.surrey.ac.uk/Teaching/Unix/.

Link to comment
Share on other sites

busi the command line is just another interface to the computer in place of a GUI (graphical user interface). 

 

The first generations of computers were partly mechanical and the user had to manipulate switches, levers, and dials to operate them while the computer printed output onto paper.  Not very user friendly.

 

Eventually we got to the point of having a keyboard and monitor.  The keyboard allowed us to type in commands and the monitor allowed us to see the output without wasting a bunch of paper.  This is your command line.

 

The next big step from here was the invention of windowed interfaces and the introduction of the mouse, which is what most people are familiar with today.

 

AFAIK, every major operating system today supports some sort of CLI.  It's mostly irrelevant to speak of the MS CLI (DOS) as it has virtually no powerful features.  *nix-based operating systems have the most powerful CLIs that I'm aware of and for power-users that are very familiar with what they're doing, typing in commands is much faster than navigating with a mouse.

 

Almost every programming language allows commands to be sent to the command line and if this ability is used properly, it is much faster than writing code.  For example, writing the *nix command to find all .txt files in a directory and all it's sub-directories is much faster than the PHP equivalent.  However, once your programs start shoveling stuff over to the command line, they are then tied to running only on systems that support that command.  For example, if your PHP script uses grep then you can not run it on most hosts that use Windows as their OS.

 

Hope that helps.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.