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
61
votes
9 answers

Examining Berkeley DB files from the CLI

I have a set of Berkeley DB files on my Linux file system that I'd like to examine. What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI…
mercutio
  • 22,151
  • 10
  • 36
  • 37
61
votes
4 answers

How do I run Rake tasks within a Ruby script?

I have a Rakefile with a Rake task that I would normally call from the command line: rake blog:post Title I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or…
Mando Escamilla
  • 1,560
  • 1
  • 10
  • 17
61
votes
1 answer

How to pipe Node.js scripts together using the Unix | pipe (on the command line)?

I see how to pipe stuff together using Node.js streams, but how do you pipe multiple scripts together using the Unix |, given that some of these scripts can be async? $ ./a.js | ./b.js Example: a.js (chmod 0755) #!/usr/bin/env…
Lance
  • 75,200
  • 93
  • 289
  • 503
60
votes
8 answers

Delete files with string found in file - Linux cli

I am trying to delete erroneous emails based on finding the email address in the file via Linux CLI. I can get the files with find . | xargs grep -l email@example.com But I cannot figure out how to delete them from there as the following code…
Spechal
  • 2,634
  • 6
  • 32
  • 48
60
votes
19 answers

'touch' is not recognized as an internal or external command, operable program or batch file

I work with laravel 5 , when i type in windows cmd this command "touch storage\database.sqlite" this error message rise 'touch' is not recognized as an internal or external command, operable program or batch file. any hint to solve it ?
HussamDev
  • 599
  • 1
  • 4
  • 6
60
votes
2 answers

How to distinguish command-line and web-server invocation?

Is there a way to distinguish if a script was invoked from the command line or by the web server? (See What is the canonical way to determine commandline vs. http execution of a PHP script? for best answer and more detailed discussion - didn't find…
Piskvor left the building
  • 91,498
  • 46
  • 177
  • 222
59
votes
6 answers

Mac OS: /usr/bin/env: bad interpreter: Operation not permitted

I'm trying to run this script on Mac OS 10.7 (Lion) and I'm getting the error: $ bbcolors -bash: /usr/local/bin/bbcolors: /usr/bin/env: bad interpreter: Operation not permitted I've successfully run this script on other Macs of mine. It's just this…
Nick
  • 3,172
  • 3
  • 37
  • 49
58
votes
1 answer

Timeline for "Device Login" and/or alternatives to offline_access + one time login

I have a small, dinosaur-era command line interface (CLI) app for facebook. There's not a huge user base, but it has its niche. Its most altruistic usage is by those who are partially blind and rely on other text-based command line interfaces. It…
57
votes
3 answers

What does the `2>` mean on the Unix command-line?

scriptlist=`ls $directory_/fallback_* 2> /dev/null` What exactly is the purpose of the 2> part of the command? I omitted it and ran the command, it just works fine. And, if the output of ls is getting stored in /dev/null file, what exactly the…
Smith
  • 607
  • 1
  • 5
  • 12
57
votes
2 answers

Custom tab completion in python argparse

How to get shell tab completion cooperating with argparse in a Python script? #!/usr/bin/env python import argparse def main(**args): pass if __name__ == '__main__': parser = argparse.ArgumentParser() …
wim
  • 338,267
  • 99
  • 616
  • 750
56
votes
3 answers

PHPunit result output on the CLI not showing test names

I'm running a brand new test suite in PHPUnit, I'd like to see the result of each test with the test name next to it. It would make fixing broken tests and TDD easier. PHPunit does output the broken messages afterwards but your eyes go wonky after…
Jujhar Singh
  • 3,641
  • 5
  • 29
  • 38
51
votes
6 answers

How to check with PHP if the script is being run from the console or browser request?

I tried things like $_ENV['CLIENTNAME'] == 'Console' but that seems to work on only certain OS's (worked in windows, not linux). I tried !empty($_ENV['SHELL']) but that doesn't work always either... Is there a way to check this that will work in…
EdanB
  • 1,456
  • 3
  • 15
  • 15
49
votes
4 answers

Is there any way to specify --endpoint-url in aws cli config file

The aws command is aws s3 ls --endpoint-url http://s3.amazonaws.com can I load endpoint-url from any config file instead of passing it as a parameter?
48
votes
6 answers

PHP CLI won't log errors

PHP currently will not log errors produced from the command line. I have: log_errors = On error_log = /var/log/php_errors.log in file /etc/php5/cli/php.ini. Am I missing a further setting to get this working?
bcmcfc
  • 25,966
  • 29
  • 109
  • 181
47
votes
4 answers

How to enable color for PHP CLI?

How do I enable the colors for output of CLI? The below one is, running on Ubuntu. If you see the screenshot, obviously the colors is enabled for terminal. And, if I call echo, it doesn't colorize the result, but if I use echo -e, it colorizes. I…
Barbayar Dashzeveg
  • 647
  • 1
  • 7
  • 11