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
820 votes
10 answers
852k 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.
user avatar
  • 9,963
488 votes
2 answers
254k 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 ...
user avatar
  • 5,119
460 votes
15 answers
271k 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 ...
user avatar
393 votes
11 answers
178k 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?
user avatar
  • 9,028
387 votes
5 answers
308k 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 ...
user avatar
370 votes
13 answers
215k 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 ...
user avatar
340 votes
1 answer
433k 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 ...
user avatar
  • 3,401
297 votes
12 answers
481k 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 ...
user avatar
  • 3,218
262 votes
13 answers
500k 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&...
user avatar
  • 3,993
237 votes
21 answers
319k 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 ...
user avatar
  • 5,265
232 votes
5 answers
445k 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?
user avatar
  • 2,479
194 votes
4 answers
130k views

Need a cli to check the sha256 hash of a file

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?
user avatar
  • 2,748
188 votes
5 answers
112k 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 ...
user avatar
  • 2,750
187 votes
10 answers
201k 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?
user avatar
169 votes
15 answers
87k 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 ...
user avatar
  • 4,749
169 votes
6 answers
802k 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.
user avatar
  • 5,085
148 votes
4 answers
66k 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 ...
user avatar
  • 3,639
143 votes
5 answers
379k views

List all devices connected, lsblk for Mac OS X

In Linux if I want to see all the devices currently connected to my computer in the command-line, I run: lsblk or blkid What's the equivalent command under Mac OS X? NOTE The goal here is ...
user avatar
132 votes
11 answers
75k 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 ...
user avatar
  • 5,275
124 votes
9 answers
80k 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
user avatar
  • 1,490
123 votes
7 answers
85k 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-...
user avatar
  • 1,343
122 votes
16 answers
132k 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 ...
user avatar
  • 27.3k
119 votes
5 answers
68k 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 ...
user avatar
  • 2,088
117 votes
11 answers
55k 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 ...
user avatar
  • 1,373
117 votes
3 answers
995k views

How to open files via Terminal

I want to open videos and pictures from Terminal. Is there any way to do this?
user avatar
109 votes
9 answers
179k 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?
user avatar
  • 1,311
104 votes
2 answers
175k 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 ...
user avatar
90 votes
10 answers
367k 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 ...
user avatar
  • 4,633
87 votes
17 answers
64k 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 ...
user avatar
87 votes
6 answers
151k 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 ...
user avatar
  • 2,023
82 votes
7 answers
264k 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 -...
user avatar
  • 3,067
79 votes
7 answers
59k 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 ...
user avatar
  • 1,283
78 votes
7 answers
75k 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?
user avatar
  • 1,285
75 votes
3 answers
126k 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.
user avatar
  • 27.3k
75 votes
5 answers
93k 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/...
user avatar
  • 1,464
73 votes
5 answers
57k 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?
user avatar
71 votes
19 answers
148k 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 ...
user avatar
69 votes
20 answers
55k 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 ...
user avatar
  • 691
69 votes
2 answers
83k 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} ...
user avatar
68 votes
12 answers
39k 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?
user avatar
  • 1,592
67 votes
6 answers
68k 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?
user avatar
  • 4,722
66 votes
5 answers
96k 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 ...
user avatar
  • 761
62 votes
8 answers
47k 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 ...
user avatar
  • 793
61 votes
4 answers
45k 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 ...
user avatar
  • 23.4k
60 votes
2 answers
14k views

Where should I store command line applications?

When I download command line applications they are located in my ~/Downloads/ directory. But I feel this is wrong place to have a command line application located. Where in the Mac OS X filesystem ...
user avatar
  • 5,473
55 votes
5 answers
67k 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 ...
user avatar
  • 2,071
51 votes
7 answers
75k views

How to always show menubar with fullscreen apps?

Does anyone know if it is possible to keep the menubar in Mac OS Lion visible for fullscreen apps instead of hidden until hovered over with a mouse or trackpad? I imagine there's some Terminal ...
user avatar
  • 610
49 votes
5 answers
18k views

Is there a way to access a Mac's geolocation from terminal?

Some GUI apps use OS X location services, but I want to retrieve a Mac's physical location from the command line. This could be useful for running scripts, switching settings etc. The mechanism should ...
user avatar
  • 3,350
48 votes
3 answers
26k 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?
user avatar
47 votes
1 answer
126k views

How do I uninstall the command line tools for Xcode?

We have a bunch of Mac at work that no longer require Xcode or command line tools so we'd like to remove them so the compilers aren't hanging around and we don't have to keep updating them when ...
user avatar
  • 221k

1
2 3 4 5
56