Questions tagged [command-line]

Using programs and commands that do not have a graphical user interface (GUI) but are rather controlled by typing text commands into a terminal program, or shell.

A command-line interface () is a mechanism for interacting with a computer operating system or software by typing commands to perform specific tasks. On macOS the default shell is zsh and in the past it was bash. This tag is appropriate for all shells and command line questions whether using the terminal.app or other program to access that shell. This text-only interface contrasts with the use of a mouse pointer with a graphical user interface () to click on options, or menus on a text user interface (TUI) to select options. A notable benefit of the command line is the ability to chain commands and operate with files as input and output which lead to powerful capabilities for automation and scripting.

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.

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.

NOTE: Questions relating to programming (purely about the language, syntax, or runtime errors) belong at Stack Overflow where programming questions are best asked and answered. This tag is preferred for questions that don’t relate directly to terminal.app the program as it is more general covering ssh, any terminal type app that use the features of the idiom and shell languages.

2894 questions
901
votes
11 answers

List of all packages installed using Homebrew

Is it possible to and how do I get a list of all the packages installed on my Mac using Homebrew? I am not interested in packages installed outside of Homebrew.
amphibient
  • 10,813
  • 7
  • 23
  • 29
513
votes
3 answers

What is the difference between `brew` and `brew cask`?

So, what is the difference between brew and brew cask? I know that homebrew is a package management software. But what kind of software can I get there? Is it open source software and commercial software?
elzaphod
  • 5,369
  • 2
  • 15
  • 11
470
votes
15 answers

git auto-complete for *branches* at the command line?

On my Linux machine I have autocomplete for branches with Git. [Note we are talking about git branch completion, not bash completion (e.g. commands, files, etc). Thus NOT Lane's answer at all] For example I can type git checkout+TAB and get a list…
Michael Durrant
  • 16,996
  • 20
  • 48
  • 71
443
votes
11 answers

iTerm - going one word backwards and forwards

Would it be possible to configure iTerm 2 to go backwards and forwards one word through the curent text in the command line using a keyboard shortcut?
syntagma
  • 9,758
  • 12
  • 37
  • 53
408
votes
5 answers

What is the difference between .bash_profile and .bashrc?

To make an alias for the Terminal in OS X, you can either put the aliases in .bash_profile or .bashrc. What is the difference between the two and why would I choose to put aliases in one and not the other?
daviesgeek
  • 37,296
  • 51
  • 158
  • 200
391
votes
1 answer

How do I launch Finder from terminal or command line

I use command line a lot, like most programmers. I want to be able to launch Finder, Safari or any other application for that matter from command line e.g. finder . where it will start Finder app, and the set the view to the current folder that…
Vijay Kumar
  • 3,911
  • 2
  • 12
  • 3
383
votes
13 answers

How can I trigger a Notification Center notification from an AppleScript or shell script?

I'd love to be able to take advantage of 10.8's Notification Center features in AppleScripts and shell scripts I write. Is there a built-in command or a third-party library I can use from either an AppleScript or shell script? Ideally the type and…
Nathan Greenstein
  • 28,124
  • 24
  • 102
  • 135
303
votes
14 answers

Can I get the CPU temperature and fan speed from the command line in OS X?

Is there a command I can run from the command line in OS X to get the current CPU temperature and/or the fan speed(s)? To be more specific, I'd like to be able to get the same info available in the iStat widget under the Fans and Temps tabs on the…
matt b
  • 3,278
  • 4
  • 19
  • 16
272
votes
13 answers

Why doesn't .bashrc run automatically?

I put some alias commands in my .bashrc file, so that they might be loaded everytime I open a new Terminal window. Yet this doesn't happen. I have to select run script: in the Terminal>Preferences>"MyDefaultTheme">Shell prefpane and add: source…
romeovs
  • 4,143
  • 8
  • 23
  • 32
250
votes
5 answers

Can I open files in TextEdit from the Terminal in Mac OS X?

I frequently find that a Terminal command to open a file in TextEdit would be very handy. Does such a command exist on Mac OS X?
wfbarksdale
  • 2,659
  • 2
  • 14
  • 8
244
votes
22 answers

Is there a Mac OS X Terminal version of the "free" command in Linux systems?

On Linux, I often use the free command to see the current amount of free and used memory in the system. For example: $ free total used free shared buffers cached Mem: 7264256 1010952 6253304 0…
hpy
  • 5,365
  • 12
  • 37
  • 47
200
votes
4 answers

Need a cli to check the sha256 hash of a file

To check the sha1 of a file I would use openssl sha1 I'm not sure what to use to check the sha256 hash of the file however, what would you recommend?
erikvold
  • 2,828
  • 4
  • 20
  • 20
198
votes
10 answers

What is the difference between iTerm2 and Terminal?

I keep hearing that iTerm2 is much better than Terminal. However, when I downloaded iTerm2, I didn't see what made it preferable over Terminal. What are the differences between these two apps?
daviesgeek
  • 37,296
  • 51
  • 158
  • 200
192
votes
5 answers

Homebrew: Your CLT does not support macOS 11.0

I recently upgraded to macOS Big Sur developer Beta 8, when I do brew install jenv I get the error Homebrew: Your CLT does not support macOS 11.0. I am using CommandLine tools GM version. Tried to reinstall it couple of times, nothing worked so…
Pavan Jadda
  • 2,790
  • 2
  • 9
  • 15
186
votes
6 answers

How do I run a .sh or .command file in Terminal

I've always wanted to be able to run a script I've downloaded online directly from the Finder but just double clicking the file does not work.
Maximus
  • 5,415
  • 3
  • 15
  • 18
1
2 3
99 100