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
68
votes
8 answers

How to cartoon-ify an image programmatically?

My app works with photos and videos of people, which I want to cartoonify. So I need an algorithm to do it manually (we use c++/Qt for our product, which has image manipulation classes) or perhaps some CLI program that will do it for me that I can…
JimDaniel
  • 12,513
  • 8
  • 61
  • 67
67
votes
5 answers

Are there standards for Linux command line switches and arguments?

This is more about the invocation of a program, than any language or parser (though I'm sure choice of parser library can depend on this). See, I've used a lot of Linux command-line utilities. And there are some obvious patterns; '-' precedes a…
DigitalMan
  • 2,440
  • 5
  • 26
  • 32
66
votes
9 answers

Parsing arguments to a Java command line program

What if I wanted to parse this: java MyProgram -r opt1 -S opt2 arg1 arg2 arg3 arg4 --test -A opt3 And the result I want in my program is: regular Java args[] of size=4 org.apache.commons.cli.Options[] of size=3 org.apache.commons.cli.Options[] #2…
djangofan
  • 28,471
  • 61
  • 196
  • 289
66
votes
2 answers

How to exclude a specific directory in ncdu?

How do I exclude a directory from ncdu scanning? I can't found the information in man ncdu page. When doing ncdu -x / it scanned my /home/tmp directory for almost an hour.
Drunken M
  • 2,013
  • 2
  • 11
  • 18
65
votes
6 answers

How do I identify the particular Linux flavor via command line?

I'd like to be able to detect which particular Linux flavor is installed on a computer, e.g. Ubuntu vs Fedora, via a command line command. Some people recommend uname -a, but that only reports the kernel version.
mcandre
  • 22,868
  • 20
  • 88
  • 147
65
votes
6 answers

Is there an easy way to pass a "raw" string to grep?

grep can't be fed "raw" strings when used from the command-line, since some characters need to be escaped to not be treated as literals. For example: $ grep '(hello|bye)' # WON'T MATCH 'hello' $ grep '\(hello\|bye\)' # GOOD, BUT QUICKLY BECOMES…
salezica
  • 74,081
  • 25
  • 105
  • 166
64
votes
3 answers

The way to distinguish command-mode and insert-mode in Bash's Vi command line editing

I'm always little bit confused when bash in vi-mode is switched to insert-mode, because it doesn't give any tip about used mode (command or edit). Is there any way to distinguish mods? May be automatic change of cursor color or something like that?
chuwy
  • 6,310
  • 4
  • 20
  • 29
64
votes
8 answers

How to make gpg prompt for passphrase on CLI

The encryption tool of gnuPG package gpg prompts for passphrase using a GUI dialog box when invoked by a regular user, however when invoked by root it prompts on CLI. How to make it use the CLI even when invoked by a regular user. version:GnuPG…
Mayank Pundir
  • 641
  • 1
  • 5
  • 4
63
votes
5 answers

AWS CLI CloudFront Invalidate All Files

I am attempting to invalidate an entire static website. The following command does not seem to invalidate /index.html and gives an odd output of items to be invalided, as shown below. Is this AWS CLI behaviour normal or am I missing something?…
63
votes
19 answers

Best way to extract MAC address from ifconfig's output?

What is the best way to extract the MAC address from ifconfig's output? Sample output: bash-3.00# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 1F:2E:19:10:3B:52 inet addr:127.0.0.66 Bcast:127.255.255.255 Mask:255.0.0.0…
Aman Jain
  • 10,927
  • 15
  • 50
  • 63
62
votes
5 answers

Set max_execution_time in PHP CLI

I know that PHP CLI is usually used because of none time limits and primary because it is not using Apache threads/processes. But is there any way how to explicitly set the max_execution_time for some scripts which i don't want to have the freedom…
Radek Simko
  • 15,886
  • 17
  • 69
  • 107
62
votes
7 answers

CLR and CLI - What is the difference?

I want to know what exactly is the difference between CLR & CLI? From whatever I have read so far, it seems to indicate that CLI is a subset of CLR. But isn't everything in the CLR mandatory? What exactly may be left out of CLR to create a CLI?
Naveen
  • 74,600
  • 47
  • 176
  • 233
62
votes
1 answer

Is there a definitive *nix command line tool for inspecting protocol buffers?

I'm looking for a command-line utility that will, at a minimum, render binary protobuf data in human-readable form. Filtering and selection options (along the lines of cut for text) would be nice, but the primary object is to make the data visible…
comingstorm
  • 25,557
  • 3
  • 43
  • 67
62
votes
5 answers

Print the last line of a file, from the CLI

How to print just the last line of a file?
yael
  • 2,765
  • 10
  • 40
  • 48
61
votes
6 answers

How to launch an EDITOR (e. g. vim) from a python script?

I want to call up an editor in a python script to solicit input from the user, much like crontab e or git commit does. Here's a snippet from what I have running so far. (In the future, I might use $EDITOR instead of vim so that folks can customize…
sam
  • 763
  • 1
  • 5
  • 7