Skip to main content

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.

command-line-interface
Filter by
Sorted by
Tagged with
4132 votes
13 answers
1.5m views

grep: show lines surrounding each match [closed]

How do I grep and show the preceding and following 5 lines surrounding each matched line?
Mark Harrison's user avatar
1568 votes
23 answers
1.2m views

Merge / convert multiple PDF files into one PDF [closed]

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 ...
alcohol's user avatar
  • 23.5k
851 votes
12 answers
868k views

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 ...
Dave Thompson's user avatar
834 votes
25 answers
826k views

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 ...
Igor Barinov's user avatar
  • 24.1k
588 votes
8 answers
956k views

An example of how to use getopts in bash

I want to call myscript file in this way: $ ./myscript -s 45 -p any_string or $ ./myscript -h #should display help $ ./myscript #should display help My requirements are: getopt here to get ...
MOHAMED's user avatar
  • 43k
576 votes
8 answers
169k views

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's user avatar
  • 31.8k
575 votes
34 answers
559k views

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 ...
Nick Heiner's user avatar
544 votes
14 answers
1.0m views

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 ...
nebuch's user avatar
  • 6,825
536 votes
17 answers
2.1m views

How to create a file in Linux from terminal window? [closed]

What's the easiest way to create a file in Linux terminal?
raffian's user avatar
  • 31.8k
516 votes
24 answers
459k views

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 ...
Ebin Davis's user avatar
  • 5,919
434 votes
20 answers
352k views

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 ...
Anders's user avatar
  • 10k
408 votes
6 answers
556k views

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 ...
user avatar
400 votes
25 answers
175k views

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 ...
anddoutoi's user avatar
  • 10.1k
385 votes
31 answers
426k views

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 -> ...
user115561's user avatar
  • 3,981
349 votes
14 answers
135k views

Delete node_modules folder recursively from a specified path using command line

I have multiple npm projects saved in a local directory. Now I want to take backup of my projects without the node_modules folder, as it is taking a lot of space and can also be retrieved any time ...
Sumit's user avatar
  • 4,022
348 votes
10 answers
169k views

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

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 ...
Martin Konecny's user avatar
330 votes
30 answers
502k views

Docker gets error "failed to compute cache key: not found" - runs fine in Visual Studio

I've generated a Dockerfile with Visual Studio. It runs in Visual Studio just fine and now I'm trying to build it from Windows itself (docker build ., and I tried many combinations). Yet I get the ...
Sjardi Djoy Willems's user avatar
328 votes
5 answers
209k views

Skip download if files already exist in wget?

Here is a simple wget command: wget http://www.example.com/images/misc/pic.png How to make wget skip download if pic.png is already available ?
nais inpoh gan's user avatar
325 votes
4 answers
158k views

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 ...
TCSGrad's user avatar
  • 12k
316 votes
15 answers
322k views

Is there a better Windows Console Window? [closed]

I find working on the command line in Windows frustrating, primarily because the console window is wretched to use compared to terminal applications on linux and OS X such as "rxvt", "xterm", or "...
Alana Storm's user avatar
289 votes
19 answers
733k views

Switch php versions on commandline ubuntu 16.04

I have installed php 5.6 and and php 7.1 on my Ubuntu 16.04 I know with Apache as my web server, I can do a2enmod php5.6 #to enable php5 a2enmod php7.1 #to enable php7 When I disable php7.1 in Apache ...
salimsaid's user avatar
  • 3,385
270 votes
2 answers
127k views

Is there a way to continue broken scp (secure copy) command process in Linux? [closed]

I am copying 7.5 GB file to a remote server using scp command. At some point in time file transfer breaks and I have to start all over again. Is the temporary amount of file being transferred ...
Matko's user avatar
  • 3,436
260 votes
12 answers
387k views

Command-line svn for Windows?

Is there a command-line based version of svn for Windows? I know I can get TortoiseSVN, but that just doesn't work for me.
Pieter's user avatar
  • 32.4k
236 votes
7 answers
79k views

Linux equivalent of the Mac OS X "open" command [closed]

I've found the "open" command in Mac OS X very handy in the command line. From "man open": The open command opens a file (or a directory or URL), just as if you had double-clicked the file's ...
user avatar
234 votes
6 answers
232k views

Git commit in terminal opens VIM, but can't get back to terminal

Trying to learn GitHub at the moment and doing this Git essentials tutorial over at nettuts. I'm on the lesson about making commits. The teacher types git commit and it opens VIM as his editor (I'd ...
Leon Gaban's user avatar
  • 38.8k
206 votes
6 answers
83k views

How to configure Mac OS X term so that git has color? [closed]

I've seen a Mac OS X git demo online in which it's configured to have multiple colors. For example, his prompt is amber, his ls directory is purple and his git diff output has ~ 4 colors (pink, light ...
yinglcs's user avatar
  • 2,363
197 votes
15 answers
26k views

How do I avoid typing "git" at the begining of every Git command?

I'm wondering if there's a way to avoid having to type the word git at the beginning of every Git command. It would be nice if there was a way to use the git command only once in the beginning after ...
Nocturnal's user avatar
  • 2,037
194 votes
29 answers
111k views

Docker push to AWS ECR hangs immediately and times out

I'm trying to push my first docker image to ECR. I've followed the steps provided by AWS and things seem to be going smoothly until the final push which immediately times out. Specifically, I pass ...
Jesse McMullen-Crummey's user avatar
191 votes
9 answers
223k views

Execute and get the output of a shell command in node.js

In a node.js, I'd like to find a way to obtain the output of a Unix terminal command. Is there any way to do this? function getCommandOutput(commandString){ // now how can I implement this ...
Anderson Green's user avatar
189 votes
13 answers
393k views

Exiting from python Command Line

To exit from Python command line, I have to type exit(). If I type exit, it says Use exit() or Ctrl-Z plus Return to exit Usually when you type exit, you would want to exit the program. Why does ...
Ank's user avatar
  • 6,210
173 votes
5 answers
47k views

What is the canonical way to determine commandline vs. http execution of a PHP script?

I have a PHP script that needs to determine if it's been executed via the command-line or via HTTP, primarily for output-formatting purposes. What's the canonical way of doing this? I had thought it ...
Bobby Jack's user avatar
  • 15.8k
172 votes
11 answers
127k views

How to change Firebase user login identity from command line (CLI)?

I'm trying to login to Firebase using login credentials of, let's say, User-Alice. But when I go through the authorization procedure I get a message saying I'm logged in as User-Bob. This is not ...
Let Me Tink About It's user avatar
164 votes
8 answers
207k views

Attach to a processes output for viewing

How would I 'attach' a console/terminal-view to an applications output so I can see what it may be saying? How would I detach from an applications output without killing the application? Normally if ...
aggitan's user avatar
  • 2,234
164 votes
20 answers
712k views

Laravel 5 – Clear Cache in Shared Hosting Server

The question is pretty clear. php artisan cache:clear Is there any workaround to clear the cache like the above command but without using CLI. I am using a popular shared hosting service, but as per ...
Duke's user avatar
  • 36.4k
158 votes
7 answers
471k views

Add text at the end of each line

I'm on Linux command line and I have file with 127.0.0.1 128.0.0.0 121.121.33.111 I want 127.0.0.1:80 128.0.0.0:80 121.121.33.111:80 I remember my colleagues were using sed for that, but after ...
user2275580's user avatar
  • 1,589
151 votes
7 answers
166k views

Change working directory in my current shell context when running Node script

I am trying to change the working directory of my Node.js script when it is run from a bin script. I have something like the following: #!/usr/bin/env node process.chdir('/Users') When I then run ...
Jonovono's user avatar
  • 2,069
142 votes
2 answers
145k views

Node js Get folder path from a file

Is there a way to get the path to a folder that holds a particular file. fs.realpathSync('config.json', []); returns something like G:\node-demos\7-node-module\demo\config.json I just need G:\...
blessanm86's user avatar
  • 31.7k
138 votes
10 answers
110k views

How can I beautify JavaScript code using Command Line?

I am writing a batch script in order to beautify JavaScript code. It needs to work on both Windows and Linux. How can I beautify JavaScript code using the command line tools?
grom's user avatar
  • 16k
136 votes
13 answers
146k views

Does PHP have threading?

I found this PECL package called threads, but there is not a release yet. And nothing is coming up on the PHP website.
Thomas Owens's user avatar
133 votes
28 answers
121k views

How do I delete a versioned bucket in AWS S3 using the CLI?

I have tried both s3cmd: $ s3cmd -r -f -v del s3://my-versioned-bucket/ And the AWS CLI: $ aws s3 rm s3://my-versioned-bucket/ --recursive But both of these commands simply add DELETE markers to ...
NobleUplift's user avatar
  • 5,816
127 votes
2 answers
113k views

How to remove globally a package from Composer?

I ran this command to install globally PHPUnit: composer global require 'phpunit/phpunit=3.7.*' Now I want to uninstall globally PHPUnit. Any ideas?
winkster's user avatar
  • 1,373
126 votes
7 answers
80k views

How can I split my Click commands, each with a set of sub-commands, into multiple files?

I have one large click application that I've developed, but navigating through the different commands/subcommands is getting rough. How do I organize my commands into separate files? Is it possible to ...
Brad T's user avatar
  • 1,593
125 votes
9 answers
115k views

How do I list all installed NuGet packages?

How does one list all locally installed NuGet packages? Is there a NuGet equivalent of RPM -qa? Within Chocolatey there is the chocolatey list -localonly, but for the life of me I cannot find the ...
Rhodope's user avatar
  • 1,251
118 votes
5 answers
115k views

How to change the output folder for migrations with asp.net Core?

Does anyone know how to change the output directory of the following command? dotnet ef migrations add Initial --context EsportshubApi.Models.ApplicationDbContext I tried to add the option: --...
DenLilleMand's user avatar
  • 4,280
116 votes
3 answers
59k views

Redirect stdout pipe of child process in Go

I'm writing a program in Go that executes a server like program (also Go). Now I want to have the stdout of the child program in my terminal window where I started the parent program. One way to do ...
mbert's user avatar
  • 1,495
114 votes
23 answers
315k views

Fatal error: Maximum execution time of 300 seconds exceeded

I keep getting this PHP error: Fatal error: Maximum execution time of 300 seconds exceeded I have tried setting my max_execution_time and my max_input_time settings in php.ini (both apache and cli)...
dez's user avatar
  • 2,255
113 votes
6 answers
92k views

envsubst: command not found on Mac OS X 10.8

When I try to run a script that contains the envsubst command, I get this error. Looking online, this seems to be a standard bash command, so I am not sure what to install in order to get it to work.
Andrew's user avatar
  • 6,811
105 votes
10 answers
145k views

How to get tf.exe (TFS command line client)?

What's the minimum amount of software I need to install to get the 'tf.exe' program?
213897's user avatar
  • 1,571
103 votes
8 answers
30k views

'git log' output encoding issues in Windows 10 CLI terminal

Problem How can I make git log command output properly displayed in the Windows CLI terminal? Example As you can see, I can type diacritical characters properly, but on git log, the output is somehow ...
Marcin Kłopotek's user avatar
100 votes
6 answers
57k views

.NET 6.0 C# "new console template" - how to read CLI arguments?

Now that .NET 6.0 is out, what appears to have be a radical update to the default CLI project template is the absence of the familiar boilerplate being reduced to the following: // See https://aka.ms/...
djtubig-malicex's user avatar

1
2 3 4 5
193