Questions tagged [command-line-interface]

The interface to a program that consists entirely of text, as opposed to (although not necessarily mutually exclusive to) a GUI, or Graphical User Interface.

A command line interface (CLI) is an interface to a program based on a series of typed text lines, called commands, which follow a specific language structure. The command lines are then interpreted by a Command Language Interpreter (more commonly known as a Shell).

The CLI was a popular interface since the 1960's, and even with development of more modern UI experiences such as , it is still a ubiquitous interface today. Depending on the specific command language, the CLI could provide a quicker and more accurate way to perform commands compared to alternatives.

Useful Resources

9389 questions
47
votes
2 answers

Lock statement vs Monitor.Enter method

I suppose that this is an interesting code example. We have a class -- let's call it Test -- with a Finalize method. In the Main method there are two code blocks where I am using a lock statement and a Monitor.Enter() call. Also, I have two…
Vokinneberg
  • 1,912
  • 2
  • 18
  • 31
47
votes
8 answers

Call a PHP function from the command line

I have a file called address.php with a few functions in it. I want to call a specific function in that file from the command line. How? The name of the function is called exportAddress and that function expects a single parameter.
Jack Smit
  • 3,093
  • 4
  • 30
  • 45
46
votes
7 answers

How to enable autocomplete in iTerm2

Let's say I'm in my root directory, and I have a User folder that I can cd into. In my default Mac terminal, I can just type cd U + tab, and it autocompletes to cd Users/. How do I get this to work in iTerm2? It used to work just fine in iTerm2,…
Farid
  • 1,557
  • 2
  • 21
  • 35
46
votes
8 answers

What is the REST (or CLI) API for logging in to Amazon Cognito user pools

How do i make logins happen via Amazon Cognito REST APIs (for user pools) on platforms for which there is no official SDK? - Note that i am asking for user pools - not identity pools. Synopsis Amazon cognito provides 3 kinds of logins: federated…
Rakib
  • 12,376
  • 16
  • 77
  • 113
46
votes
4 answers

Command line zip everything within a directory, but do not include any directory as the root

I can't find the answer to this for the life of me. Because I am packaging a zip in a specific way for a build process, I don't want to include a folder at all in the resulting zip at the root. For example, if I have this file path: MyFolder/ …
Eli
  • 4,874
  • 6
  • 41
  • 50
45
votes
18 answers

NPM Publish Registry - 403 Forbidden - "You don't have permission to publish "..."

I've been trying to publish my package to the NPM Registry. I get an error that I am not allowed to push my package to the registry. 403 Forbidden - PUT https://registry.npmjs.org/qdb - You do not have permission to publish "qdb". Are you logged in…
Smally
  • 1,556
  • 1
  • 8
  • 27
45
votes
2 answers

Using jq, convert array of objects to object with named keys

Given a json file in the format as : [ { name : "A", value : "1" }, { name : "B", value : "5" }, { name : "E", value : "8" } ] How would I convert it to something like this using jq: { "A" : { name : "A", value : "1" }, …
Mike N
  • 453
  • 1
  • 4
  • 4
44
votes
3 answers

PS1 line-wrapping with colours problem

Here's my PS1 variable: PS1='\u:\W$(__git_ps1 "\e[32m\][%s]\e[0m\]")$ ' Works great for picking up my Git branch, but it has the unfortunate side-effect of wrapping the lines when the colours are active, so that they overlap when you use long…
Aupajo
  • 5,885
  • 6
  • 30
  • 28
43
votes
1 answer

Take picture from webcam using linux command line (bash)

I am well aware that there is "exactly" the same question already asked, but it seems the user that posted the question initially never took an interest in the question, and the answers all were for windows systems. I want to take a picture with…
Stoppal
  • 683
  • 1
  • 5
  • 15
43
votes
4 answers

Why does my C# array lose type sign information when cast to object?

Investigating a bug, I discovered it was due to this weirdness in c#: sbyte[] foo = new sbyte[10]; object bar = foo; Console.WriteLine("{0} {1} {2} {3}", foo is sbyte[], foo is byte[], bar is sbyte[], bar is byte[]); The output is "True…
Rngbus
  • 2,911
  • 3
  • 22
  • 17
42
votes
1 answer

How to move multiple messages in mutt

Before all of my messages were in one maildir. Now I want move all arch-general mail to another one. From here, I see: "move" as we know it from other places is "save" in mutt. "save" as we know it from other places is "copy" in mutt. ~e EXPR …
Paul Yin
  • 1,753
  • 2
  • 13
  • 19
41
votes
9 answers

PHP Server Name from Command Line

Is there a way to detect the name of the server running a PHP script from the command line? There are numerous ways to do this for PHP accessed via HTTP. But there does not appear to be a way to do this for CLI. For example:…
Justin Noel
  • 5,945
  • 10
  • 44
  • 59
41
votes
4 answers

Create Python CLI with select interface

I'd like to create a Python CLI with an item selection interface that allows users to choose an item from a list. Something like: Select a fruit (up/down to select and enter to confirm): [x] Apple [ ] Banana [ ] Orange I'd like users to be able to…
Dan Zheng
  • 1,493
  • 2
  • 13
  • 22
41
votes
4 answers

Achieve "npm run x" behavior without a "scripts" entry?

To run a node command within the "context" of your installed node_modules, you can make an entry in the scripts field of package.json. Eg: ... "scripts": { "test": "mocha --recursive test/**/*.js --compilers js:babel-register" } ... and…
Jonah
  • 15,806
  • 22
  • 87
  • 161
40
votes
1 answer

Is it possible to prefill a input() in Python 3's Command Line Interface?

I'm using Python 3.2 on Ubuntu 11.10 (Linux). A piece of my new code looks like this: text = input("TEXT=") Is it possible to get some predefined string after the prompt, so I can adjust it if needed? It should be like this: python3…
Exeleration-G
  • 1,360
  • 16
  • 29