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
4123
votes
13 answers

grep: show lines surrounding each match

How do I grep and show the preceding and following 5 lines surrounding each matched line?
Mark Harrison
  • 297,451
  • 125
  • 333
  • 465
1504
votes
23 answers

Merge / convert multiple PDF files into one PDF

How could I merge / convert multiple PDF files into one large PDF file? I tried the following, but the content of the target file was not as expected: convert file1.pdf file2.pdf merged.pdf I need a very simple/basic command line (CLI) solution.…
alcohol
  • 22,596
  • 4
  • 23
  • 21
823
votes
12 answers

Execute a command line binary with Node.js

I am in the process of porting a CLI library from Ruby over to Node.js. In my code I execute several third party binaries when necessary. I am not sure how best to accomplish this in Node. Here's an example in Ruby where I call PrinceXML to convert…
Dave Thompson
  • 8,453
  • 3
  • 16
  • 11
790
votes
24 answers

How do I edit a file after I shell to a Docker container?

I successfully shelled to a Docker container using: docker exec -i -t 69f1711a205e bash Now I need to edit file and I don't have any editors inside: root@69f1711a205e:/# nano bash: nano: command not found root@69f1711a205e:/# pico bash: pico:…
Igor Barinov
  • 21,820
  • 10
  • 28
  • 33
572
votes
8 answers

Pretty print in MongoDB shell as default

Is there a way to tell Mongo to pretty print output? Currently, everything is output to a single line and it's difficult to read, especially with nested arrays and documents.
raffian
  • 31,267
  • 26
  • 103
  • 174
547
votes
32 answers

How to open Visual Studio Code from the command line on OSX?

The docs mention an executable called code, but I'm not sure where I can find that so I can put it on my path. The zip I downloaded from the VSCode site did not include any such executable. (I am able to run the .app just fine.) Is this a…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
532
votes
17 answers

How to create a file in Linux from terminal window?

What's the easiest way to create a file in Linux terminal?
raffian
  • 31,267
  • 26
  • 103
  • 174
516
votes
14 answers

Command prompt won't change directory to another drive

I'm trying to compile some java (learning java currently), and to do so I need to change command-prompt's directory. C:\...\Admin> cd D:\Docs\Java C:\...\Admin> cd C:\...\Admin It doesn't change the directory. I try again using…
nebuch
  • 6,475
  • 4
  • 20
  • 39
471
votes
22 answers

How to change the project in GCP using CLI commands

How can I change the current running project to another project in GCP (Google Cloud Platform) account using cli commands other than using gcloud init manually? gcloud projects list will list the projects running on my account. I want to change the…
Ebin Davis
  • 5,421
  • 3
  • 15
  • 20
434
votes
20 answers

How can I open the Atom editor from the command line in OS X?

I have the Atom editor and was wondering how you can open a file or folder from the terminal in Atom. I am using a Mac. I am looking for a way to do this: atom . (opens folder) atom file.js (opens file) atom (opens editor) Is this possible and…
Anders
  • 9,988
  • 7
  • 30
  • 36
394
votes
24 answers

Is it possible to create a remote repo on GitHub from the CLI without opening browser?

I created a new local Git repository: ~$ mkdir projectname ~$ cd projectname ~$ git init ~$ touch file1 ~$ git add file1 ~$ git commit -m 'first commit' Is there any git command to create a new remote repo and push my commit to GitHub from here? I…
anddoutoi
  • 9,973
  • 4
  • 29
  • 28
383
votes
6 answers

Send request to cURL with post data sourced from a file

I need to make a POST request via cURL from the command line. Data for this request is located in a file. I know that via PUT this could be done with the --upload-file option. curl host:port/post-file -H "Content-Type: text/xml" --data…
user253202
350
votes
30 answers

Git error on git pull (unable to update local ref)

I only have a master branch and I'm getting this error every time I try to git pull: error: Couldn't set refs/remotes/origin/master From /var/lib/git/xxx/project ! a0f80ea..49177a3 master -> origin/master (unable to update local ref) And…
user115561
  • 3,631
  • 2
  • 14
  • 8
336
votes
10 answers

Highlight text similar to grep, but don't filter out text

When using grep, it will highlight any text in a line with a match to your regular expression. What if I want this behaviour, but have grep print out all lines as well? I came up empty after a quick look through the grep man page.
Martin Konecny
  • 57,827
  • 19
  • 139
  • 159
321
votes
4 answers

How can I expand/collapse a diff sections in Vimdiff?

I've started using vimdiff today, and wanted to do some of the things that I've taken for granted on Windows based diff editors (like expand/collapse a diff section, have full file expansion/only diffs with three context lines above or below, etc.).…
TCSGrad
  • 11,898
  • 14
  • 49
  • 70
1
2 3
99 100