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.

Filter by
Sorted by
Tagged with
998 votes
11 answers
1.2m views

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's user avatar
  • 11.9k
536 votes
3 answers
316k views

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 ...
elzaphod's user avatar
  • 5,599
528 votes
12 answers
259k views

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's user avatar
  • 10.9k
480 votes
16 answers
312k views

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 ...
Michael Durrant's user avatar
456 votes
1 answer
650k views

How do I launch Finder from terminal or command line [duplicate]

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 ...
Vijay Kumar's user avatar
  • 4,561
427 votes
5 answers
352k views

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 ...
daviesgeek's user avatar
402 votes
13 answers
244k views

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 ...
Nathan Greenstein's user avatar
351 votes
6 answers
975k views

How can I list my open network ports with netstat?

I would like to list my open network ports in Terminal with built in commands. As what I know, netstat is the command to use. But I'm struggling to get any useful information out of it. How can I ...
Jonas's user avatar
  • 6,272
315 votes
14 answers
535k views

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 ...
matt b's user avatar
  • 3,398
284 votes
14 answers
551k views

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&...
romeovs's user avatar
  • 4,373
265 votes
5 answers
509k views

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's user avatar
  • 2,809
255 votes
22 answers
359k views

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 ...
hpy's user avatar
  • 5,545
205 votes
6 answers
1.1m views

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's user avatar
  • 5,815
204 votes
4 answers
143k views

Need a cli to check the sha256 hash of a file [duplicate]

To check the sha1 of a file I would use openssl sha1 <file> I'm not sure what to use to check the sha256 hash of the file however, what would you recommend?
erikvold's user avatar
  • 2,888
201 votes
10 answers
232k views

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's user avatar
192 votes
15 answers
102k views

How to move files to trash from command line?

I do a lot of terminal work, and today had the experience of typing rm fileInQuestion.txt Before finding out that I did actually need fileInQuestion.txt. If I'd deleted in the GUI then I would have ...
Joe's user avatar
  • 5,049
192 votes
5 answers
88k views

Suppressing "The default interactive shell is now zsh" message in macOS Catalina

I know Catalina uses zsh as the default login shell and interactive shell, but it is very annoying when I open iTerm.app or run command with /bin/bash, it shows verbose message like below: $ /bin/bash ...
Gasol Wu's user avatar
  • 4,634
192 votes
5 answers
121k views

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 ...
Pavan Jadda's user avatar
  • 2,790
169 votes
6 answers
440k views

Is there a `lsblk` equivalent for macOS that lists all attached storage devices?

In Linux if I want to see all the devices currently connected to my computer in the command-line, I run: lsblk or blkid The goal here is to be able to obtain information about all storage devices ...
Alexej Magura's user avatar
148 votes
11 answers
86k views

Can home and end keys be mapped when using Terminal?

The Home and End keys on a MacBook Pro can be emulated with Fn + ← or fFn + →. Or when certain settings are changed, with the ⌘ Command key instead of Fn. None of these works in Terminal. As I ...
at01's user avatar
  • 5,595
145 votes
16 answers
165k views

What directory comparison tools can I use on OS X?

I am looking for a tool that is able to compare directories, not only files. Also it is important to be able to call the tool from the command line. It would be great to have a free tool, but feel ...
sorin's user avatar
  • 29.9k
143 votes
10 answers
112k views

How can I combine multiple PDFs using the command line?

Is there a quick one-liner to combine multiple pdfs into one? I know it can be done using Preview.app
reacuna's user avatar
  • 1,680
140 votes
6 answers
111k views

Update bash to version 4.0 on OSX

Is it possible to actually update bash to version 4.0 in OSX Yosemite? echo $BASH_VERSION 3.2.57(1)-release This article and this thread refer to the same question, but they install a new shell side-...
sluijs's user avatar
  • 1,513
139 votes
12 answers
71k views

Repeatedly Being Asked to Install Command Line Tools

When I'm doing various development-related activities (such as initializing a git repository or installing packages in RStudio), I get repeatedly asked to install command line developer tools, even ...
RPatel99's user avatar
  • 1,761
133 votes
6 answers
79k views

Linux' `ps f` (tree view) equivalent on OSX?

How can I get a tree view like the one below on OSX? vartec@some_server:~$ ps xf PID TTY STAT TIME COMMAND 11519 ? S 0:00 sshd: vartec@pts/0 11520 pts/0 Ss 0:00 \_ -bash ...
vartec's user avatar
  • 2,308
132 votes
3 answers
1.2m views

How to open files in another app via Terminal on macOS?

I want to open videos and pictures from my command line shell. Is there a way terminal app can do this?
abhimanyuaryan's user avatar
122 votes
11 answers
63k views

How do I speed up new Terminal tab loading time?

How can i speed up the terminal startup in Lion? I'm not referring to the startup of the Terminal application, but to the startup terminal windows, like when i open a new tab. I don't have anything ...
Fernando's user avatar
  • 1,423
120 votes
10 answers
220k views

How can I unpack .7z files via MacOS terminal?

Looking to unpack a bunch of files.7z via terminal. Is there a command-line tool built in, available or I shall install an application that comes with a graphical interface?
SuperAtic's user avatar
  • 1,421
104 votes
6 answers
187k views

Is there a command to install a dmg

I want to install a dmg file on a remote server. All I have is an ssh access. Since a DMG is a disk image, I tried to mount it, but mount does not seem to recognize its format. file says my dmg file ...
philant's user avatar
  • 2,353
104 votes
2 answers
182k views

Why doesn't Mac OS X source ~/.bashrc? [duplicate]

I found a lot of people figuring out why instruction similar to this : Put X to your ~/.bashrc and you can do Y don't work. It always turns out that Mac OS X's bash's startup files (or Mac's Bash ...
Paweł Brewczynski's user avatar
99 votes
10 answers
418k views

How do I start TextEditor from the command line?

I work a lot at the command line in a Terminal and would like to start a text editor on a certain file. I'm from Linux Land and normally use kwrite or gedit from a bash shell. Trying to find the Mac ...
DarenW's user avatar
  • 5,143
96 votes
7 answers
133k views

Determine xcode command line tools version

How do I determine what version(s) of xcode command line tools I have? I tried doing $ gcc --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/...
Andrew Grimm's user avatar
  • 1,676
90 votes
19 answers
74k views

How to get a notification when my commands are done

I'm running a series of commands on the command line that takes approximately twenty minutes to complete. I'd like to see some sort of notification on my Mac when these are finished so I don't need ...
Amir Afghani's user avatar
  • 1,003
89 votes
7 answers
89k views

How can I track progress of dd

I am using the following command to create a bootable SD Card sudo dd bs=4m if=en_windows_10_enterprise_version_1511_x64_dvd_7224901.iso of=/dev/disk2 Is there a way to track the progress?
SeanClt's user avatar
  • 1,404
89 votes
7 answers
290k views

How can I list all user accounts in the terminal?

How can I list all local user accounts in Terminal (whether logged in or not?) The commands users or who does not provide this information. OS X version is 10.6.8. I have seen this suggested command -...
codecowboy's user avatar
  • 3,272
87 votes
3 answers
50k views

How to install an homebrew formula without updating homebrew itself?

When I install or reinstall a formula, homebrew automatically update itself before installing the formula. When working on a slow connection, this is annoying. How can I cancel this automatic update?
Ortomala Lokni's user avatar
85 votes
5 answers
69k views

Install shuf on OS X?

Ubuntu Linux has a great tool called shuf, which works like head except that it gives you ten random lines. I couldn't find it on Homebrew. What is the simplest way of installing it on OS X?
The Unfun Cat's user avatar
85 votes
3 answers
165k views

How can I display the current DNS servers from the command line under OS X?

I want to display the DNS servers that are used by the current network setup on OS X, from the command line.
sorin's user avatar
  • 29.9k
83 votes
7 answers
67k views

How can I make 'rm' move files to the trash can?

I use the terminal on a daily basis, I will often use rm DirectoryName. Sometimes I get a little impatient and do rm * without deliberating if it’s safe. As you can imagine, these shenanigans have ...
steve's user avatar
  • 1,333
82 votes
5 answers
117k views

how to reinstall xcode command-line tools?

I had serious problems from two versions of Xcode on the same machine. I removed all Xcode app instances & many other non-System 'xcode'-related files, then reinstalled the app (4.6.2), fixing my ...
sierra's user avatar
  • 921
75 votes
2 answers
91k views

Run AppleScript from bash script

If I wanted to run an AppleScript from within a bash script I could call a file with the list of commands that I require to execute. #!/bin/bash {some commands} osascript file.scpt {other commands} ...
Danijel-James W's user avatar
74 votes
20 answers
62k views

Lock Screen Command One-Liner

I'm trying to find out whether there is any kind of equivalent command line one-liner which replicates the exact identical functionality of the 'Lock Screen' menu option available via the Keychain app ...
user40433's user avatar
  • 741
74 votes
13 answers
44k views

How can I change a file or folder icon using the Terminal

How can I change or set the icon for a file or folder, in the terminal, do I need to use a scripting language?
ocodo's user avatar
  • 1,673
74 votes
5 answers
91k views

How to upgrade Homebrew itself (not softwares/formulas installed by it) on macOS?

I have homebrew installed long before the OS is upgraded a few times to 10.12.3. Now that $ brew --version Homebrew 0.9.9 (git revision 080c; last commit 2016-08-11) Homebrew/homebrew-core (git ...
qazwsx's user avatar
  • 2,581
71 votes
19 answers
149k views

Password dialog appears when SSH private key permissions are set to 0600

I installed my SSH private key in ~/.ssh/id_rsa and set its permissions to 0600. When I connect to an SSH server which uses my private key in Terminal.app via ssh, a dialog pops up and asks me to ...
titaniumdecoy's user avatar
70 votes
8 answers
55k views

How can I install the Command Line Tools completely from the command line?

I'd like to script the installation of the Xcode Command Line Tools. On Mavericks, xcode-select --install will open a dialog prompting the user to install, but I'd like to trigger the install without ...
also's user avatar
  • 873
68 votes
4 answers
53k views

How do I reset the scrollback in the terminal via a shell command?

When using Terminal.app, you can clear the screen by using the shell builtin clear or by pressing ^+L (Control-L). However, all this does is push the current screen content back one screen height ...
Jason Salaz's user avatar
  • 24.5k
68 votes
6 answers
70k views

How to get BSD FTP and Telnet back in 10.13 (High Sierra)?

There are some real problems with not having ftp and telnet present in 10.13 now as per Apple's dictate. Has anyone found a solid way to bring BSD ftp and telnet back to macOS vs using inetutils?
ylluminate's user avatar
  • 5,321
67 votes
8 answers
91k views

My command line says `complete:13: command not found: compdef `

When I use a terminal like iTerm or Hyper, right as I boot it up, the first message I get is: complete:13: command not found: compdef I don't know what this is from, and how to get rid of it. This ...
aaron's user avatar
  • 1,033
65 votes
4 answers
59k views

Can't delete keychain items with UI, but command line works fine

When using the Keychain Access app, I am often unable to delete an Web form password item. I have tried hitting the delete key and going to Edit > Delete. In both cases, nothing happens, there is no ...
Simon Woodside's user avatar

1
2 3 4 5
64