CLI: Difference between revisions

From YSTV Documentation Wiki
(Created page with "= Overview = A [https://en.wikipedia.org/wiki/Command-line_interface CLI] (Command Line Interface) is just a means of giving a system instructions using text. While [https://e...")
 
mNo edit summary
Line 3: Line 3:


=== Windows ===
=== Windows ===
Windows is not usually managed in a terminal but over the years it adapted certain CLI tools for different purposes. For local system management you usually have [https://en.wikipedia.org/wiki/Cmd.exe cmd.exe] (although [https://github.com/Microsoft/Terminal Windows Terminal] is much better) and for managing [Active Directory|networks of Windows systems]] you use [https://en.wikipedia.org/wiki/PowerShell Powershell], which lets you manage users and file structures across multiple computers at once.  
Windows is not usually managed in a terminal but over the years it adapted certain CLI tools for different purposes. For local system management you usually have [https://en.wikipedia.org/wiki/Cmd.exe cmd.exe] (although [https://github.com/Microsoft/Terminal Windows Terminal] is much better) and for managing [[Active Directory|networks of Windows systems]] you use [https://en.wikipedia.org/wiki/PowerShell Powershell], which lets you manage users and file structures across multiple computers at once.  


=== Linux (and other Unix-based systems) ===
=== Linux (and other Unix-based systems) ===
These days it's fairly optional to use the command line in Linux but when you're managing [[servers|Computing:Servers]] it's actually far far better to just learn how to use it, especially thanks to some [https://www.gnu.org/ very good software] designed entirely on a basis of [https://en.wikipedia.org/wiki/Unix_philosophy simplicity and ease of use]. Lookup how to use [https://www.gnu.org/software/bash/ Bash] and some basic programs in [https://www.gnu.org/software/coreutils/manual/html_node/index.html GNU Core Utils] and you'll be able to manage any of our servers without a problem.
These days it's fairly optional to use the command line in Linux but when you're managing [[Computing: Servers|Linux servers]] it's actually far far better to just learn how to use it, especially thanks to some [https://www.gnu.org/ very good software] designed entirely on a basis of [https://en.wikipedia.org/wiki/Unix_philosophy simplicity and ease of use]. Lookup how to use [https://www.gnu.org/software/bash/ Bash] and some basic programs in [https://www.gnu.org/software/coreutils/manual/html_node/index.html GNU Core Utils] and you'll be able to manage any of our servers without a problem.


= Using command lines =
= Using command lines =

Revision as of 15:45, 30 October 2021

Overview

A CLI (Command Line Interface) is just a means of giving a system instructions using text. While GUIs usually look more intuitive, after some learning curve CLIs are usually faster, less complex and very easy to automate. At YSTV we only really use two different kinds of CLI languages: Powershell (for Windows) and Bash (for Linux).

Windows

Windows is not usually managed in a terminal but over the years it adapted certain CLI tools for different purposes. For local system management you usually have cmd.exe (although Windows Terminal is much better) and for managing networks of Windows systems you use Powershell, which lets you manage users and file structures across multiple computers at once.

Linux (and other Unix-based systems)

These days it's fairly optional to use the command line in Linux but when you're managing Linux servers it's actually far far better to just learn how to use it, especially thanks to some very good software designed entirely on a basis of simplicity and ease of use. Lookup how to use Bash and some basic programs in GNU Core Utils and you'll be able to manage any of our servers without a problem.

Using command lines

Scripting

An advantage of CLI programs is being able to join them together and automate long tasks with nothing but a short interpreted script. In YSTV's github we have Scripts-and-Configs where we store misc bash scripts and config files.

Arguments and Config

Most linux programs have two ways of changing their effect. First, you can send an argument (e.g. "--help" is a standard way of displaying all the options you can give a program) to set certain variables or adjustments when you run a program. Secondly, you can set config files (e.g. vimrc) which change how a program works EVERY time you run it.

Config files usually have a hierarchy to them - just remember that they prioritise the closest config file to the user. So for example you can have '/etc/CONFIG_FILE' (for all users) then '/home/USERNAME/.CONFIG_FILE' (for just one user), the one in the '/home' folder will take priority over the one in '/etc'. Info about where these config files are stored is usually at the bottom of a man(ual) page or, if you're using Windows, just google it and it'll likely be in some obscure folder somewhere.