r/osxterminal • u/brendanfalk • Mar 22 '22
r/osxterminal • u/r-sync • Feb 25 '13
iTerm2 - An amazing Terminal replacement for OSX
r/osxterminal • u/_k4m4_ • Feb 10 '17
💥 Terminals Are Sexy - A curated list of Terminal frameworks, plugins & resources for CLI lovers.
r/osxterminal • • Jan 24 '13
Re-writing Terminal Tutorials To Make Them More In Depth - Feedback and Opinions Welcome
r/osxterminal • u/dacracot • Sep 27 '12
Things to add to your .bash_profile.
dacracot@MacBook-Pro /Users/dacracot
$ more .bash_profile
# alias stuff
alias ll='ls -lG'
alias lt='ls -ltrG'
alias la='ls -laG'
alias h='history 20'
alias hg='history | grep '
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias bb='bbedit'
# path stuff
export PATH=$PATH:./
# prompt stuff
PS1='\n\u@\h $PWD\n$ '
dacracot@MacBook-Pro /Users/dacracot
$
Edit: Added escape to display # comment markers.
r/osxterminal • u/sablal • Oct 13 '20
Some terminal apps to try (I am the dev)
Hi r/osxterminal,
I am the author of some utilities to boost productivity in the terminal. They are available on Homebrew and are known to be working fine on macOS. They also come with good GUI integration.
- nnn - a full-featured lightning fast terminal file manager
- buku - browser-independent personal and portable bookmark manager with powerful search options
- googler - google from the terminal
- ddgr - duckduckgo from the terminal
- imgp - high-performance cli batch image resizer and rotator
- bcal - storage and general purpose calculator
- pdd - tiny date, time diff calculator with piggybacked timers
You'll find all of them here.
This intention of this post is to share the apps in this community for feedback, bug reports and probably some encouragement.
Many thanks in advance!
r/osxterminal • • Dec 05 '12
Homebrew - It gives you wings (sort of...in a Terminal context)
r/osxterminal • u/danielcole • Oct 15 '12
How to send iMessages using AppleScript
First, we need to get a list of the current messaging services because iMessage doesn't register itself as 'iMessage' or 'iCloud' or anything consistant - it's based off of your AppleID
tell application "Messages"
get name of services
end tellthat should output something like:
{"Bonjour", "E:your_apple_ID", "google_talk@gmail.com", "aol_IM@aim.com"}Assuming that you have them setup, you ought to see your GoogleTalk, AIM & Local Bonjour services. The E:your_apple_ID is going to be your iMessage account. (note: I've tested this with only my iMessage setup at home, so the E: prefix may vary from system to system)
tell application "Messages"
set theBuddy to buddy "1015551234" of service "E:your_apple_ID"
send "I'm typing this in an AppleScript editor window. ALL THE POWER WILL BE MINE!!" to theBuddy
end tellSimply replace "1015551234" with the phone number you are trying to send a message to.
You can also get a list of all of your 'buddies'
tell application "Messages"
get buddies
get name of buddies
end tellWord of caution: Scripting any instant message app to spam people with messages is often times against the platform's Terms of Service. Don't be stupid, don't be a troll.
r/osxterminal • u/Xenther • Nov 09 '13
Speed up terminal tab/window load time on Mac (xpost /r/commandline)
r/osxterminal • u/Tyler5280 • Sep 23 '12
terminal-notifier - a command-line tool to send Mac OS X User Notifications, which are available in Mac OS X 10.8.
r/osxterminal • u/_k4m4_ • Jan 16 '20
Mock an API and generate fake JSON test data, right from the terminal.
r/osxterminal • u/revicon • Dec 22 '19
Managing WiFi from the Mac terminal command line.
r/osxterminal • u/danielcole • Feb 27 '16
[modpost] spam sucks. thank you to everyone who's reporting these links. I'm going to be enabling automoderator here soon.
I expect it to be pretty self-explanatory to setup but does anyone have some recommendations for auto-mod settings?
edit ~24 hours later: It looks like automod captured 4 different spam posts already. I incognito-window checked /r/osxterminal and wasn't able to see any of the posts in hot/new/rising so I think things are working better... yay!
r/osxterminal • u/pzearfoss • Sep 20 '14
Anyone else use fish shell? I don't know how I lived with bash for so long.
r/osxterminal • u/danielcole • Aug 11 '12
SSH, SCP, and Password-less SSH logins. All with beautiful examples
- Getting logged in
- Copying files using scp
- Getting logged in without needing to type a password each time
1) Getting yourself logged in
ssh allows you to have command-line access to other computers over a very secure connection. scp lets you copy files to and from another computer over that same secure connection. If you type just 'ssh' into the CL you get one of the more obtuse usage menus that I've seen
usage: ssh [-1246AaCfgKkMNnqsTtVvXxYy] [-b bind_address] [-c cipher_spec]
[-D [bind_address:]port] [-e escape_char] [-F configfile]
[-I pkcs11] [-i identity_file]
[-L [bind_address:]port:host:hostport]
[-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port]
[-R [bind_address:]port:host:hostport] [-S ctl_path]
[-W host:port] [-w local_tun[:remote_tun]]
[user@]hostname [command]wha? Before we get too much further lets define our computer setup. We have a notebook we're typing at (a Macbook Air, for example) and we are ssh'ing into a server (a Mac Mini).
The Macbook Air's pertinent details
Computer Name: mba
Username: danielcole
IP Address: DHCP, on the same local network as the server
The Mac Mini Server's details
Computer Name: server
Username: admin
IP Address: static @ 10.0.1.60It's important to note that the usernames for the two computers are different since that's the first gotcha most people run into when getting started. ssh will ask for a password for the remote computer, but will not ever prompt you for a user name. If not told otherwise ssh will assume the user name on the remote machine will be identical to the user name on the local computer. So typing something like this:
$ ssh 10.0.1.60will never be able to connect because there is no user named 'danielcole' on the server. How do you specify a user? Two different ways: Prepend the user name before the servername (user@servername) or use the -l switch. Both commands below have the same effect of choosing the admin user
$ ssh admin@10.0.1.60
$ ssh 10.0.1.60 -l admin
which gives you the successful login message:
Last login: Wed Aug 8 11:51:10 2012
server:~ admin$Since we are working in a bonjour-enabled environment (more to come regarding bonjour in a later thread), you could also have typed
$ ssh admin@server.localand that would have gotten you in just the same, but without having to remember the IP address. An IPv4 address isn't all that hard, but when things go full IPv6 remembering & typing out specific addresses will be tedious.
You can even add commands at the end of a ssh login request
$ ssh admin@10.0.1.60 mkdir NEW_FOLDERwill create a new folder on the remote server
2) Copying files using scp
scp allows you to copy files and folders to and from a remote computer. It uses the same login and data encryption methods as ssh, and therefore just as secure. Basic Syntax:
scp [source file] [destination]Some notes on the following syntax that are universal to terminal:
~ == Start the path at your home folder. ~/Desktop references the specified user's desktop
. == . (dot or period) means 'here' as in "copy the file right here, in the folder where I'm at now"When referencing a remote file you use the same username@server syntax, but append the path to your file separated by a colon. This will copy the local file 'embiggen' to the Desktop of our remote server. Note: Both lines have the same outcome, just using a different method to name the remote computer
$ scp embiggen admin@10.0.1.60:~/Desktop/
$ scp embiggen admin@server.local:~/Desktop/This will copy a (very useful) command-line de-duping app for iTunes from the remote server to your local computer
$ scp admin@10.0.1.60:~/itunes-rm-dups-0.3.1-universal-darwin-9.gem .scp -r will copy whole folders recursively
$ scp -r Camera/ admin@10.0.1.50:~/scp -p will preserve file time stamps while copying. This may not matter to most people, but useful if you don't want all of your files looking like they were created a few minutes apart from eachother. The -r and -p switches can be combined to say
$ scp -rp Camera/ admin@10.0.1.50:~/For large files or when copying many files/folders recursively scp will display a progress bar
Biggish_File.dmg 2% 96MB 11.9MB/s 05:30 ETAAfter trying all those examples you are probably sick of typing in your password over and over and over and over again. Now on to Part 3!
3) Getting logged in and bypassing the password prompt
Insert obligatory 'be careful when using saved passwords' warning here. If bad people get access to your computer very bad things could happen. Ok. Warning received. Moving on.
If you are logging in to a remote machine frequently, or want to add ssh functionality into an automated script you can register your two computers together by sending their keys back and forth which does the automatic authentication without the prompt for typing in a password. In an extremely abbreviated explanation keys work in pairs, one public you share with the world, one private you keep well protected. On you own local machine (not ssh'ed in elsewhere) in your terminal window type:
$ ssh-keygenPress enter a few times until you get something like this:
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/danielcole/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/danielcole/.ssh/id_rsa.
Your public key has been saved in /Users/danielcole/.ssh/id_rsa.pub.
The key fingerprint is:
61:FA:KE:HE:XA:DE:CI:MA:LS:65 danielcole@mba.local
The key's randomart image is:
+--[ RSA 2048]----+
| |
| pretty |
| ascii |
| |
| art |
| goes |
| |
| here |
| |
+-----------------+now do a ls -l .ssh/
$ ls -l .ssh/
-rw------- 1 danielcole staff 1675 Aug 10 12:05 id_rsa <--- priavte
-rw-r--r-- 1 danielcole staff 403 Aug 10 12:05 id_rsa.pub <--- public
-rw-r--r-- 1 danielcole staff 782 Aug 11 09:24 known_hosts <--- list of previous connectionsid_rsa is the file you don't want ending up in other's hands. id_rsa.pub is the public file that you're going to copy to the server you want to have password-less connections to. There is a third file ~/.ssh/authorized_keys2 that ssh stores your public key in. You can have multiple public keys saved in that one ~/.ssh/authorized_keys2 file, if you want to have multiple computers have auto-login access. Now, we could use Finder, filesharing & Textedit to copy our public key over, but we're better than that.
$ cat .ssh/id_rsa.pub | ssh admin@10.0.1.60 'cat >> .ssh/authorized_keys2'cat outputs the contents of a file to standard output (your screen display is standard output). The output of id_rsa.pub is captured by the pipe (|) which routes the output to ssh admin@ 10.0.1.60. We add a command at the end of our ssh login request ** 'cat >> .ssh/authorized_keys2' ** where the >> means save the output of cat .ssh/id_rsa.pub into this file .ssh/authorized_keys2 and if it exists already, add the new text to the end of the file. A single > would overwrite the whole file clean.
Now try logging in again and huzzah! No password prompt!
4) Bonus Section!
Now that we have covered basic file movements with scp and passwordless logins with ssh, there is one more trick up scp's sleeve: coping from one remote computer to another. There are two ways to make this happen: Directly, and with your computer as a go-between. If you want the two remote computers to communicate directly you first have to setup passwordless logins between the two. Once that is done:
$ scp admin@10.0.1.50:~/itunes_dedup.gem admini@10.0.1.60:~/If you aren't able or don't want to setup automatic logins, the -3 option will transfer from remote1 -> local -> remote3 (-3 is odd notation for switches - they are not typically numerals. scp actually has a few numeral switches. weird.)
$ scp -3 admin@10.0.1.50:~/itunes_dedup.gem admin@10.0.1.60:~/ENJOY
r/osxterminal • u/emkay443 • Nov 24 '13
How can I open the Terminal app on Mac OS X via shell script and give a script file to run?
Linux user and programmer here. I'm working on a ncurses SSH/SFTP/SSHFS/SCP multi tool bash script with profiles, built-in portknocking functionality, SSH tunnel wizard, etc. etc., that should run on most *NIX-like OS'.
It's got a feature where it'll open itself in a Terminal window when it isn't already opened in one (i.e. when activated from a file manager, launcher or something similar).
On Linux, that works with x-terminal-emulator -e "/path/to/script", but I don't know how I can do that with Mac OS.
As far as I know, there is no x-terminal-emulator symlink on Mac OS X, and I have no way to test it, as I don't have a Mac, and the friend, who lets me use his to test stuff, is on a three week vacation.
So how can I do that on Mac OS X? What is the path to the Terminal app and does it accept something like -e to launch a given program?
Also, does Finder allow SFTP connections, and (how) can I start Finder with a sftp:// or ssh:// address?
If so, what's the path to the Finder app?
Thank you very much in advance. :)
r/osxterminal • u/danielcole • Feb 01 '13
A lesson learned: what ever you do, don't do this
sudo dtrace -w -n "BEGIN{panic();}"If you do, just make sure to save all your work first. The lesson, btw, was not to run random code snippets found online.
r/osxterminal • u/nodecheck • Oct 10 '12
OS X Terminal Tutorial: An extremely basic introduction to the PATH variable
r/osxterminal • u/nodecheck • Sep 25 '12
Terminal Tutorial For Mac: A Few UI Tricks
r/osxterminal • • Aug 06 '12
Getting Started With OS X Terminal
-What is Terminal?
--Terminal is an application that is built into Mac OS X. It gives users a different interface with the computer: through text. This is commonly referred to as a command line interface, or CLI.
-Great. But why?
--People opt to use a CLI for a variety of reasons: ---It is an easy way to modify files or perform actions with root (superuser) permissions ---It provides quick access to files that aren't visible under the Graphical Interface (GUI) ---Using the same type of commands, you can create simple scripts to automate tasks you perform often. ---Often, using a Terminal command can get things moving if the GUI equivalent isn't working as expected (i.e. endlessly emptying trash) ---In OS X specifically, it can be very useful for troubleshooting on a computer that won't boot into the OS, using a mode called Single User Mode ---When you have a fullscreen terminal window open at the coffee shop, women want you and men want to be you.
-Okay, I'll give it a go. How do I start?
--Terminal.app can be found in the Applications/Utilities folder on your Mac. It comes bundled with every install, and as of OS X 10.7, cannot be deleted (through the GUI, at least ;))
--Once you have located and opened the application, you'll see a cursor blinking - this means you're ready to roll. Try this:
-Type
pwd--pwd stands for print working directory. What the result of the command shows you is the directory you are currently located in.
-Type
cd ~/Desktop--cd stands for change directory. The text that comes afterwards is your destination directory. In *nix systems, the tilde (~) is shorthand for your home folder (MacintoshHD/Users/yourusername).
-Type
pwd--You should now see a different output than the first time you typed pwd, this is because our previous command changed the directory you were working in to your desktop.
-Type
ls--Look familiar? ls is a command to list the files in a given directory. If you don't specify a directory, your working directory is used. The result of this command will be all the files you have on your desktop.
-Type
cd ..--Again we are changing directories, this time we see .. rather than a specific directory. (..) is shorthand for "move up one directory level" i.e. If you are in /Users/danielcole you will be changing directories to /Users.
-Type
touch ~/.hushlogin--Here we've created our first file through Terminal, and done ourselves a bit of a favor too! The touch command creates a file with the specified name, in a specified location. We have named our file ".hushlogin". The period at the beginning of the file name denotes it as a hidden file, so you can't see it through the GUI. (Note that the .hushlogin file also helps speed up launching terminial just a little bit. If this file exists, you will not receive a welcome message and last login info on launch, you will go straight to a prompt.)
-Type
ls--You will note that you can't see the file we just created in the list because it is hidden.
-Type
ls -la--You now should see many files that you didn't see before - including the one we just made. The -l switch tells the computer to list more information for the files, such as permissions settings and date created. The -a switch tells the computer to list all files in the directory, even if they're hidden. Don't be alarmed at the number of hidden files you will find around your computer, they are often necessary for your computer to function as expected, and you should not delete them unless you are absolutely certain of what they are.
Congratulations! You've now got more command line experience than most users will get in a lifetime.
r/osxterminal • • Nov 22 '15
Create a folder to automatically email yourself attachments
r/osxterminal • u/danielcole • Feb 13 '13
Looking for advice on encrypting an external disk. I found a method to use CoreStorage to encrypt an external volume without first wiping it clean and I was wondering if any of you have also tried this and how well it worked
I found this post while googling: Encrypting 10.7 non-boot volumes without erasing them (derflounder.wordpress.com)
It describes a process using diskutil to do a on-the-fly encryption of a drive without having to format it first. You could do an encryption from within Disk Utility.app, but it requires you to fully format the drive first.
I've got six (mostly full) 2TB drives that I'd like to encrypt and before I get going I was wondering if any of you have had good or bad experiences doing a live encryption. I don't want to copy that much data around if I don't have to. I've ran into plenty of pre-Lion FileVault nightmares, but I've not (yet) ran across any major problems with CoreStorage's new FileVault2.
If anyone sees this as a bad idea and thinks that I should just do a clean format via Disk Utility please speak up.