Difference between revisions of "Command Line Basics"
(11 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | [[Category:LinuxLV]] [[Category:Command Line Basics]] |
||
+ | Video: [https://youtu.be/535xAToR_Ew LinuxLV - Command Line Basics] |
||
− | == Advantages of CLI == |
||
+ | |||
+ | == Motivation == |
||
+ | |||
+ | === Advantages of CLI === |
||
If you install a typical Linux distribution you can use it completely with your GUI. Of course you can also do this in your server or on the raspberry-pi that you use in your weather station but for servers and small devices it is much better to use the command-line-interface (CLI). |
If you install a typical Linux distribution you can use it completely with your GUI. Of course you can also do this in your server or on the raspberry-pi that you use in your weather station but for servers and small devices it is much better to use the command-line-interface (CLI). |
||
− | Here is a list of advantages of the CLI over graphical user interfaces (GUI), most of which are specially relevant on servers that sit in a server room at the other end of town: |
+ | Here is a list of advantages of the CLI on a terminal over graphical user interfaces (GUI), most of which are specially relevant on servers that sit in a server room at the other end of town: |
+ | |||
+ | * '''Less bandwidth''': You can use terminal connection on slow and lines |
||
+ | * You do not need to install GUI components so the '''size of your OS images is drastically reduced'''. |
||
+ | * Typing commands on a good CLI is much '''faster''' and more expressive then clicking around |
||
+ | * '''Stable''' for a longer time. While the fashion of GUIs changes you would still feel comfortable on a modern Linux with the knowledge of using Unix some 40 years ago. |
||
+ | * '''Easy to document'''. While it is hard to describe which button in which tab you need to click and often you need screenshots for that, it is easy to write documentation on which command you need to enter. |
||
+ | * Easy to '''automate'''. Once you know which command to use you can put that in a script to automate longer taks. You can run them automatically a certain times or intervals or let them be triggered by external conditions. |
||
+ | |||
+ | |||
+ | === Disadvantages of CLI === |
||
+ | |||
+ | * Sometimes it is a bit harder to learn. But a good GUI will also assist you with command-completion and help text. |
||
+ | * Not so suitable for handling data that is inherently graphical: E.g. a drawing. Counterexample: <ref>While there is a good counterexample: [https://www.openscad.org/ openscad] is a program to generate 3D objects (nice for 3D printing) where you describe your geometry with a kind of programming language. While you have direct feedback how your graphic looks, the fact that you describe it with a language makes it then easy to later change something. So it is easy to create parametric object where you can change certain aspects by editing a number, etc.. In the end this is often more time saving than using a GUI-only program. </ref> |
||
+ | |||
+ | == Units == |
||
+ | |||
+ | * [[Navigating the Command Line]] |
||
+ | * [[Redirecting Input and Output with some Simple Commands]] |
||
+ | * [[Concatenating Commands with Pipes and Substitution]] |
||
+ | * [[Working with Filenames and Path and Globing]] |
||
+ | * [[Using a Text Editor]] |
||
+ | * [[Changing to a different user sudo and su]] |
||
+ | * [[Package management with apt and yum]] |
||
+ | * [[Simple Scripts and Environment Variables]] |
||
+ | |||
+ | == References and Footnotes == |
||
+ | |||
+ | <references/> |
Latest revision as of 10:54, 9 November 2020
Video: LinuxLV - Command Line Basics
Contents
Motivation
Advantages of CLI
If you install a typical Linux distribution you can use it completely with your GUI. Of course you can also do this in your server or on the raspberry-pi that you use in your weather station but for servers and small devices it is much better to use the command-line-interface (CLI).
Here is a list of advantages of the CLI on a terminal over graphical user interfaces (GUI), most of which are specially relevant on servers that sit in a server room at the other end of town:
- Less bandwidth: You can use terminal connection on slow and lines
- You do not need to install GUI components so the size of your OS images is drastically reduced.
- Typing commands on a good CLI is much faster and more expressive then clicking around
- Stable for a longer time. While the fashion of GUIs changes you would still feel comfortable on a modern Linux with the knowledge of using Unix some 40 years ago.
- Easy to document. While it is hard to describe which button in which tab you need to click and often you need screenshots for that, it is easy to write documentation on which command you need to enter.
- Easy to automate. Once you know which command to use you can put that in a script to automate longer taks. You can run them automatically a certain times or intervals or let them be triggered by external conditions.
Disadvantages of CLI
- Sometimes it is a bit harder to learn. But a good GUI will also assist you with command-completion and help text.
- Not so suitable for handling data that is inherently graphical: E.g. a drawing. Counterexample: [1]
Units
- Navigating the Command Line
- Redirecting Input and Output with some Simple Commands
- Concatenating Commands with Pipes and Substitution
- Working with Filenames and Path and Globing
- Using a Text Editor
- Changing to a different user sudo and su
- Package management with apt and yum
- Simple Scripts and Environment Variables
References and Footnotes
- ↑ While there is a good counterexample: openscad is a program to generate 3D objects (nice for 3D printing) where you describe your geometry with a kind of programming language. While you have direct feedback how your graphic looks, the fact that you describe it with a language makes it then easy to later change something. So it is easy to create parametric object where you can change certain aspects by editing a number, etc.. In the end this is often more time saving than using a GUI-only program.