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

How to create Windows EventLog source from command line?

I'm creating an ASP.NET application that will log some stuff to Windows EventLog. To do this an event source has to be created first. This requires administrative priviledges so I cannot do it in the ASP.NET app. Is there an existing command-line…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
185
votes
9 answers

What's the opposite of head? I want all but the first N lines of a file

Given a text file of unknown length, how can I read, for example all but the first 2 lines of the file? I know tail will give me the last N lines, but I don't know what N is ahead of time. So for a file AAAA BBBB CCCC DDDD EEEE I want…
Nicholas M T Elliott
  • 3,643
  • 2
  • 19
  • 15
185
votes
22 answers

Get Folder Size from Windows Command Line

Is it possible in Windows to get a folder's size from the command line without using any 3rd party tool? I want the same result as you would get when right clicking the folder in the windows explorer → properties.
Eldad Assis
  • 10,464
  • 11
  • 52
  • 78
185
votes
16 answers

How to ssh to vagrant without actually running "vagrant ssh"?

I would like to reproduce the way Vagrant logs in to my VM within a shell script using an ssh command, so I create an alias to my Vagrant instance. What is the command syntax to use the regular ssh command to access it?
Kevin Burke
  • 61,194
  • 76
  • 188
  • 305
184
votes
14 answers

Build Android Studio app via command line

I want to build an Android Studio app (the Gradle build system), but I want to do this via the command line.
183
votes
19 answers

How do I 'svn add' all unversioned files to SVN?

I'm looking for a good way to automatically 'svn add' all unversioned files in a working copy to my SVN repository. I have a live server that can create a few files that should be under source control. I would like to have a short script that I…
JerSchneid
  • 5,817
  • 4
  • 34
  • 37
182
votes
6 answers

How to pass argument to Makefile from command line?

How to pass argument to Makefile from command line? I understand I can do $ make action VAR="value" $ value with Makefile VAR = "default" action: @echo $(VAR) How do I get the following behavior? $ make action value value How about $make…
Meng Lu
  • 13,726
  • 12
  • 39
  • 47
179
votes
3 answers

Proper usage of Java -D command-line parameters

When passing a -D parameter in Java, what is the proper way of writing the command-line and then accessing it from code? For example, I have tried writing something like this... if (System.getProperty("test").equalsIgnoreCase("true")) { //Do…
Ryan Berger
  • 9,644
  • 6
  • 44
  • 56
179
votes
10 answers

How to force 'cp' to overwrite directory instead of creating another one inside?

I'm trying to write a Bash script that will overwrite an existing directory. I have a directory foo/ and I am trying to overwrite bar/ with it. But when I do this: cp -Rf foo/ bar/ a new bar/foo/ directory is created. I don't want that. There are…
saketrp
  • 2,323
  • 3
  • 16
  • 18
179
votes
5 answers

Command line: piping find results to rm

I'm trying to work out a command which deletes sql files older than 15 days. The find part is working but not the rm. rm -f | find -L /usr/www2/bar/htdocs/foo/rsync/httpdocs/db_backups -type f \( -name '*.sql' \) -mtime +15 It kicks out a list of…
jerrygarciuh
  • 21,158
  • 26
  • 82
  • 139
178
votes
3 answers

Get selected subcommand with argparse

When I use subcommands with python argparse, I can get the selected arguments. parser = argparse.ArgumentParser() parser.add_argument('-g', '--global') subparsers = parser.add_subparsers() foo_parser =…
Adam Schmideg
  • 10,590
  • 10
  • 53
  • 83
175
votes
22 answers

"No such file or directory" but it exists

I simply want to run an executable from the command line, ./arm-mingw32ce-g++, but then I get the error message, bash: ./arm-mingw32ce-g++: No such file or directory I'm running Ubuntu Linux 10.10. ls -l lists -rwxr-xr-x 1 root root 433308…
Warpspace
  • 3,215
  • 3
  • 21
  • 24
175
votes
6 answers

Comments in command-line Zsh

I switched from Bash to Zsh on Ubuntu and I'm quite happy about it. However, there is something I really miss and I did not find how to achieve the same thing. In Bash, whenever I was typing a long command and noticed I had to run something else…
fbiville
  • 8,407
  • 7
  • 51
  • 79
174
votes
3 answers

Finding the path of the program that will execute from the command line in Windows

Say I have a program X.EXE installed in folder c:\abcd\happy\ on the system. The folder is on the system path. Now suppose there is another program on the system that's also called X.EXE but is installed in folder c:\windows\. Is it possible to…
Zabba
  • 64,285
  • 47
  • 179
  • 207
172
votes
4 answers

an htop-like tool to display disk activity in linux

I am looking for a Linux command-line tool that would report the disk IO activity. Something similar to htop would be really cool. Has someone heard of something like that?
user54579
  • 4,588
  • 4
  • 23
  • 19