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.

A command-line interface () is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks. This text-only interface contrasts with the use of a mouse pointer with a graphical user interface (GUI) to click on options, or menus on a text user interface (TUI) to select options.

This method of instructing a computer to perform a given task is referred to as entering a command. The system waits for the user to conclude the submitting of the text command by pressing the Enter key (a descendant of the carriage return key of a typewriter keyboard). A command-line interpreter then receives, parses, and executes the requested user command. The command-line interpreter may be run in a text terminal or in a terminal emulator window as a remote shell client such as .

Upon completion, the command usually returns output to the user in the form of text lines on the CLI.

Related tag:

See also: Wikipedia Command-line_interface.

23435 questions
14
votes
1 answer

Execute a Groovy class in a package from the command line

Is there a way to execute a Groovy class by specifying the package with dots, as with java? Example: File ./my/package/MyClass.groovy: package my.package class MyClass { static void main(String[] args) { println "ok" } } > cd…
Olivier Gourment
  • 1,517
  • 2
  • 11
  • 9
14
votes
2 answers

Foreach loop on windows command line?

I have a command line which copies files from folder A to folder B: copy A\* B\ I would now like to delete all files in B that are present in A, non-recursively. I can list the files in A like this: dir /b /a-d A With the output…
Adam S
  • 8,945
  • 17
  • 67
  • 103
14
votes
1 answer

git: Is there a command line option for "Sort by date" for gitk?

I'm trying to find a command line option for gitk that has the same effect of "Strictly sort by date" in the "View / Edit view..." window. man gitk shows a very limited number of options compared to those available in the GUI.
digitalsky
  • 379
  • 4
  • 14
14
votes
4 answers

Create a combo command line / Windows service app

What's the best way in C# to set up a utility app that can be run from the command line and produce some output (or write to a file), but that could be run as a Windows service as well to do its job in the background (e.g. monitoring a directory, or…
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
14
votes
6 answers

Can a long sed command be broken over several lines?

I have sed command that is very long sed -i 's/append ro initrd=initrd.img quiet splash nbdport=2000/append ro initrd=initrd.img quiet splash nbdport=2000 video=LVDS-1:d/g' /var/lib/tftpboot/ltsp/i386/pxelinux.cfg/default Can it be broken over…
Sandra Schlichting
  • 25,050
  • 33
  • 110
  • 162
14
votes
2 answers

How can we know the default Installation Directory of XCode through command line?

Is there a way to know the Default Installation Directory of XCode through command line? (I know default is /Developer, but what if i changed it to /XCode42, then in this case how can i get path) Also where is those environment variables are set and…
DShah
  • 9,768
  • 11
  • 71
  • 127
14
votes
5 answers

Getting another process command line in Windows

I am trying to get another process' command-line parameters (on WinXP 32bit). I do the following: hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ | PROCESS_TERMINATE, FALSE, ProcList.proc_id_as_numbers[i]); BytesNeeded =…
Georg
  • 401
  • 1
  • 5
  • 20
14
votes
4 answers

Using services inside NestJS script run from command line

I know how to run a script from command line, using npm or npx ts-node [script.ts] just as stated here. My question is different, now that I can run scripts, can I use services that are inside modules in my project? Let's say that I have this…
Ripper346
  • 662
  • 7
  • 22
14
votes
2 answers

Is JSON safe to use as a command line argument or does it need to be sanitized first?

Is the following dangerous? $ myscript '' If so, what can I do to make it not dangerous? I realize that this can depend on the shell, OS, utility used for making system calls (if being done inside a programming…
Conley Owens
  • 8,691
  • 5
  • 30
  • 43
14
votes
5 answers

Terminate a process of a process tree in command line (Windows)

I am in need of a command that will allow me to terminate a process of a process tree. For example notepad.exe was created by explorer. How would I terminate the notepad.exe in the explorer.exe process tree ?
Peter
  • 141
  • 1
  • 1
  • 3
14
votes
5 answers

Moving files in Google Colab

I have I bunch of files in a directory, named like this: cat.10171.jpg cat.12421.jpg cat.3421.jpg I want to move part of them to another directory using this from Colab notebook: !mv cat.{0..499}.jpg /content/train I have an error: mv: cannot…
14
votes
5 answers

how to get the command line arguments from another class with java

so suppose I have a java package.... it's got the main class with the main method and then it's got a whole bunch of other classes..... my question is, is it possible to get the args that was passed into the main method from these other classes that…
kamikaze_pilot
  • 14,304
  • 35
  • 111
  • 171
14
votes
2 answers

Using schtasks from the command line, what parameter will wake the computer from sleep and execute the task

The option exists in the UI, but not in the help displayed in the command line.
thetreat
  • 315
  • 1
  • 3
  • 9
14
votes
4 answers

How to define a DOSKEY alias for multiple commands?

Following on from an answer to this question For the Windows command prompt I can define aliases as follows: @echo off DOSKEY ns=npm start DOSKEY nsr=npm run serve I want to define an alias that will combine these two commands. I tried the…
gburnett
  • 755
  • 8
  • 18
14
votes
1 answer

Node frameworks for command line apps?

I'm trying to find a pretty simple framework that I use to organise the 'architecture' of a nodejs command line app. I've found this site: http://nodeframework.com/ but it seems to be focused around web or network frameworks so am hoping someone…
Nick Middleweek
  • 1,049
  • 2
  • 11
  • 19