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.

learn more… | top users | synonyms (1)

67
votes
16answers
53k 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 ...
61
votes
7answers
34k views

What is the difference between iTerm2 and Terminal?

I keep hearing that iTerm2 is much better than Terminal. I downloaded iTerm2 today and played around with it, but I couldn't see what is so much better about iTerm2. iTerm2 seemed just like Terminal. ...
54
votes
3answers
21k views

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

On my linux machine I have autocomplete for branches with git. For example I can type git checkout [TAB] and get a list of branches. Or I can type git checkout feb* [TAB] to get all branches that ...
54
votes
5answers
85k 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?
40
votes
9answers
75k 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 ...
36
votes
6answers
14k 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 ...
33
votes
2answers
727 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 ...
27
votes
4answers
17k views

MacPorts vs. Fink vs. Homebrew

I always used MacPorts to install and maintain my GCC compilers (4.4, 4.5, 4.6, 4.7, ...) and gnuplot. Now I've heard about Fink and Homebrew. I think these two utilities are gaining ground in the Mac ...
24
votes
2answers
9k 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 ...
24
votes
5answers
27k 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 ...
22
votes
1answer
26k 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 ...
20
votes
6answers
42k 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 ...
20
votes
3answers
31k 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 ...
19
votes
10answers
24k 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 ...
19
votes
7answers
10k 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 + left arrow or fn + right arrow. Or when certain settings are changed, with the Command (Apple) key instead of fn. None of these ...
19
votes
5answers
7k 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?
18
votes
5answers
52k views

How can I list all user accounts in the terminal?

How can I list all local user accounts (whether logged in or NOT so 'users' or 'who' is no good) in the terminal on a mac? OS X version is 10.6.8. I have seen this suggested - dscacheutil -q group ...
17
votes
14answers
8k 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 ...
16
votes
4answers
5k 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 ...
16
votes
1answer
236 views

Is it possible to get via CLI the commercial name (Lion, Mountain Lion, Mavericks, …)

At the moment I'm using both uname and sw_vers darwin_version=`uname -r` osx_version=`sw_vers -productVersion` But if I want to display the commercial name (Lion, Mountain Lion, Mavericks, ...) I ...
15
votes
3answers
4k views

Can Mac App Store installs & upgrades be automated?

How can I script installing or upgrading apps from the Mac App Store? I'd prefer command line tools, but AppleScript or some other API would suffice. Relevant puzzle pieces: installer: note ...
15
votes
1answer
1k views

Why is lsof on OS X so ridiculously slow?

I can't figure out why lsof on my Mac (10.8.2, MacBook Pro) is so slow. On my Mac, lsof takes more than a minute: $ touch /tmp/testfile $ time lsof /tmp/testfile real 1m16.483s user 0m0.029s ...
14
votes
4answers
49k views

Why does OS X Mavericks block the purge command in Terminal?

When I try the purge command on my terminal, OS X Mavericks gives me the following message: Unable to purge disk buffers: Operation not permitted This hasn't been the default behavior until now. I ...
13
votes
2answers
6k views

How can I find the serial number on a mac programmatically from the terminal?

What command can I use to retrieve the system's serial number from the unix command line? As uname will output some information about the software and hardware, I would like to retrieve the serial ...
12
votes
2answers
4k views

What is the difference between .command, .tool, and .sh file extensions?

I saw a couple of questions about executing command line scripts? I saw that the .command and .tool extensions were mentioned. I have always used .sh. What is the difference between these different ...
11
votes
2answers
1k views

cd to a directory by typing its name?

For example if a directory 'blob' exists and I just type 'blob[return]' then the system cds into the blob directory for me. In Linux (Ubuntu) I can add shopt -s autocd to my .bashrc file, but on OS X ...
11
votes
2answers
24k 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 ...
10
votes
8answers
8k views

How to retrieve current wattage info on OS X?

Is there a way to retrieve the current watt usage info on OS X Snow Leopard? I'm using mid-2010 iMac, so I'm not looking for just battery-related apps. Does OS X even monitor power usage? Do I need ...
10
votes
3answers
1k views

What is the “+” mark at the end of file description?

When I execute 'ls -al~', I see + marks, and it prevents me from moving/deleting files. drwxr-xr-x+ 5 prosseek admin 170 Oct 5 03:43 Desktop drwxr-xr-x+ 17 prosseek admin 578 Sep 25 ...
10
votes
2answers
1k views

why does OSX add extra '._<filename>' when I tar a directory?

I'd just like to know why if I "tar -czf" a file/directory, osx adds a: ._ for each file? I see these when I untar in linux. Or when I work with the uncompressed project in eclipse as it doesn't ...
10
votes
3answers
3k views

How can I force command-line arguments to a program shortcut in the dock?

I have Chrome installed in Applications, and a shortcut to it in the Dock. How can I achieve to force some command-line arguments to each start-up of this app? Let me be clearer, in the Terminal, I ...
10
votes
4answers
2k views

Updating modifier key mappings through defaults command tool

I am trying to automate the inital setup of my macbook, that includes installing software and changing OS X configuration to my needs. I have tried to update the modifier keys with defaults, the ...
9
votes
4answers
8k views

How do I take a steathy picture with my iSight camera from the command line?

Is there a command line utility that allows me to take a picture from the built in camera? Something like screencapture allows for, well, screen captures. The reasoning for a command line tool is I ...
9
votes
2answers
13k views

Why Mac OS X don't 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 ...
9
votes
2answers
14k views

How do I create a symbolic link to a directory with a space in it?

I was trying to create a symbolic link using the following command: ln -s "~/Foo Bar/" Foo ... but it didn't work (i.e. when I go into finder and try double clicking it, it says that it's pointing ...
9
votes
3answers
17k views

What steps are needed to create a new user from the command line on Mountain Lion?

What commands (or script) can create a fully functional user account on Mountain Lion, running only from the command line via terminal or ssh. It looks like an existing pair of answers might work, ...
9
votes
2answers
3k views

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

I'd like to script the installation of the 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 ...
8
votes
6answers
675 views

Where can I find a comprehensive and detailed technical software manual for OS X?

Are there books written for OS X (particularly the most current version) like the hundreds of thousands written for Unix? I'd like to know about the command-line utilities and the locations of system ...
8
votes
2answers
1k views

Can user accounts be managed via the command line?

Is there any way to add, remove, or modify user accounts via the command line? I'm not talking about an account for a system process or daemon, I mean is there any way to add a user account, change, ...
8
votes
2answers
217 views

Piping multiple commands

I would like to run the following command and pipe stout of both to TextEdit: pmset -g; echo; pmset -g assertions | open -f -a TextEdit This doesn't work, it only executes the latter: How?
8
votes
3answers
442 views

Drag & Drop vs mv - Any difference?

Is there a difference between bulk-moving files with Drag & Drop vs mv? Use case: Volume External_Drive_A has about 8000 files totalling 9GB. External_Drive_B has 74GB of free space. The ...
8
votes
3answers
4k views

How do I change the time format used by ls command line on osx?

I want to make ls display time in ISO format (military format). How can I change this behavior? On Linux I knew that I could force ls to display time in long format by usin --full-time but this ...
8
votes
2answers
10k views

How to control Bluetooth wireless radio from the command line?

This question is almost the same as my previous question, but with one major difference; I want to turn on/off Bluetooth from the command line (bash or similar), NOT from AppleScript - the answers for ...
8
votes
1answer
2k views

Why does it appear that I apparently “do not have access to Command Line Tools” in ML?

I just upgraded to Mountain Lion, and now gcc, make, g++, etc. are not found when trying to launch them in Terminal. So I went to Xcode Preferences, Downloads, and clicked "Install" next to Command ...
8
votes
3answers
1k views

Copying files to the clipboard using applescript

Often I find myself at the command line wanting to copy files to the clipboard, so that I can paste them as attachments in Mail. If I have an image file, image1.png, I can accomplish this with ...
7
votes
7answers
2k views

How to list all available .plist keys on a certain domain application by defaults command?

I want to know all keys (property list) which available on certain domain application, as example i could list available key for com.apple.dock by entering this command: $ defaults read ...
7
votes
6answers
7k views

How to send an email from command line?

How to send an email from command line or script? I want to be able to run the script programmatically by passing the receiver and the message.
7
votes
3answers
4k views

How does Mountain Lion set the default text editor for the “open -t” terminal command?

OSX seem to offer open -t command line shortcut to open arbitrary files in the system default text editor. Where is this default text editor set? Can I change it from the command line (if possible) ...
7
votes
2answers
3k 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 ...
7
votes
2answers
11k 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 ...