Questions tagged [command-line]

A command line is a string given to a command interpreter that tells it actions to take, such as running programs or copying files. The interpreter processes command lines with escapes and substitutions.

Filter by
Sorted by
Tagged with
3421votes
59answers
1.5mviews

How can I pretty-print JSON in a shell script?

Is there a (Unix) shell script to format JSON in human-readable form? Basically, I want it to transform the following: { "foo": "lorem", "bar": "ipsum" } ... ...
3077votes
12answers
2.8mviews

How do I copy a folder from remote to local using scp?

How do I copy a folder from remote to local host using scp? I use ssh to log in to my server. Then, I would like to copy the remote folder foo to local /home/user/Desktop. How do I achieve this?
user avatar
2887votes
26answers
1.1mviews

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter) This morning I navigated to my work's codebase in the Command Line on ...
user avatar
  • 68.3k
2645votes
26answers
738kviews

Is there an equivalent of 'which' on the Windows command line?

As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program on the ...
user avatar
  • 35.6k
2486votes
54answers
4.3mviews

How do I import an SQL file using the command line in MySQL?

I have a .sql file with an export from phpMyAdmin. I want to import it into a different server using the command line. I have a Windows Server 2008 R2 installation. I placed the .sql file on the C ...
user avatar
  • 36k
2345votes
33answers
1.5mviews

How to change the output color of echo in Linux

I am trying to print a text in the terminal using echo command. I want to print the text in a red color. How can I do that?
user avatar
2333votes
39answers
1.8mviews

How do I parse command line arguments in Bash?

Say, I have a script that gets called with this line: ./myscript -vfd ./foo/bar/someFile -o /fizz/someOtherFile or this one: ./myscript -v -f -d -o /fizz/someOtherFile ./foo/bar/someFile What's the ...
user avatar
2129votes
14answers
2.4mviews

How do I set a variable to the output of a command in Bash?

I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" MOREF='sudo run command against $VAR1 | grep name | cut -c7-' echo $MOREF When I run this script from the ...
user avatar
  • 21.7k
1387votes
15answers
1.4mviews

How can I get a list of user accounts using the command line in MySQL?

I'm using the MySQL command-line utility and can navigate through a database. Now I need to see a list of user accounts. How can I do this? I'm using MySQL version 5.4.1.
user avatar
  • 55.7k
1315votes
28answers
1.7mviews

How to count lines in a document? [closed]

I have lines like these, and I want to know how many lines I actually have... 09:16:39 AM all 2.00 0.00 4.00 0.00 0.00 0.00 0.00 0.00 94.00 09:16:40 AM all 5.00 0.00 ...
user avatar
  • 15.8k
1181votes
22answers
1.2mviews

How do I run two commands in one line in Windows CMD?

I want to run two commands in a Windows CMD console. In Linux I would do it like this touch thisfile ; ls -lstrh How is it done on Windows?
user avatar
  • 245k
1170votes
20answers
388kviews

How to pass command line arguments to a rake task

I have a rake task that needs to insert a value into multiple databases. I'd like to pass this value into the rake task from the command line, or from another rake task. How can I do this?
user avatar
  • 46.7k
1139votes
14answers
987kviews

How to reload .bash_profile from the command line?

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bash_profile by exiting and logging back in but I would like to be able to do it on demand.
user avatar
1120votes
25answers
1.2mviews

Including all the jars in a directory within the Java classpath

Is there a way to include all the jar files within a directory in the classpath? I'm trying java -classpath lib/*.jar:. my.package.Program and it is not able to find class files that are certainly in ...
user avatar
  • 12.7k
1077votes
15answers
943kviews

git undo all uncommitted or unsaved changes

I'm trying to undo all changes since my last commit. I tried git reset --hard and git reset --hard HEAD after viewing this post. I responds with head is now at 18c3773... but when I look at my local ...
user avatar
  • 22.5k

15 30 50 per page
1
2 3 4 5
1503