To close Terminal, press ⌘ Command+Q. To change the color scheme of your Terminal window, click Terminal at the top of the screen and select Preferences. Choose one of the themes on the left side of the screen or customize the colors in the main panel.
In the never-ending search to work smarter, not harder, few things can be simpler than entering commands on one Mac and having them pushed out across the entire LAN to multiple nodes. One of these perks comes natively to OS X by way of from end-to-end between server and client machine. Unfortunately (for Mac sysadmins), Remote Login—as Apple refers to it—comes turned off, by default (fortunate for security admins). Turning the service on involves very little manual intervention, but when you multiply that by the number of Macs to administer, the task becomes incredulously time-intensive. To enable SSH, enter the command below into Terminal.app, and press Enter to execute it. Once completed, the SSH service will be enabled for all users on that authenticate on that Mac.
Systemsetup -setremotelogin on Creating an SSH access group With SSH enabled, secure access is provided to the Mac. However, if anyone can access your computer remotely, how secure is it? Not very, I'm afraid. Fortunately, this too can be changed by creating an SSH access group, where members will be provided exclusive authorization to remotely access your Mac.
Dseditgroup -o create -q com.apple.accessssh Add users (or groups) to the SSH access group By running this command, users and/or groups that are to be granted SSH access to machines will be allowed to do so, while all other users will be expressly denied access to connect or login remotely. In the example below, the admin group has been granted SSH access. Dseditgroup -o edit -a admin -t group com.apple.accessssh Since this is a command to be executed remotely, it requires some way to be executed or kicked off in order for it to process on multiple computers. While each organization may have different management suites in place, Apple Remote Desktop, DeployStudio tasks, OS X Server custom configurations, or traditional scripts will all equally get the job done and secure access to SSH. Also see.
Introduction This is a small Ruby tutorial that should take no more than 20 minutes to complete. It makes the assumption that you already have Ruby installed. (If you do not have Ruby on your computer it before you get started.) Interactive Ruby Ruby comes with a program that will show the results of any Ruby statements you feed it. Playing with Ruby code in interactive sessions like this is a terrific way to learn the language. Open up IRB (which stands for Interactive Ruby). If you’re using macOS open up Terminal and type irb, then hit enter. If you’re using Linux, open up a shell and type irb and hit enter.
If you’re using Windows, open Interactive Ruby from the Ruby section of your Start Menu. Irb(main):001:0 Ok, so it’s open. Type this: 'Hello World' irb(main):001:0 'Hello World' = 'Hello World' Ruby Obeyed You! What just happened?
Did we just write the world’s shortest “Hello World” program? The second line is just IRB’s way of telling us the result of the last expression it evaluated. If we want to print out “Hello World” we need a bit more: irb(main):002:0 puts 'Hello World' Hello World = nil puts is the basic command to print something out in Ruby. But then what’s the = nil bit? That’s the result of the expression.
Puts always returns nil, which is Ruby’s absolutely-positively-nothing value. Your Free Calculator is Here Already, we have enough to use IRB as a basic calculator: irb(main):003:0 3+2 = 5 Three plus two. What about three times two? You could type it in, it’s short enough, but you may also be able to go up and change what you just entered. Try hitting the up-arrow on your keyboard and see if it brings up the line with 3+2 on it.
If it does, you can use the left arrow key to move just after the + sign and then use backspace to change it to a. sign.
Irb(main):004:0 3.2 = 6 Next, let’s try three squared: irb(main):005:0 3.2 = 9 In Ruby. is the way you say “to the power of”.
But what if you want to go the other way and find the square root of something? Irb(main):006:0 Math.sqrt(9) = 3.0 Ok, wait, what was that last one? If you guessed, “it was figuring out the square root of nine,” you’re right. But let’s take a closer look at things.
First of all, what’s Math? Modules Group Code by Topic Math is a built-in module for mathematics. Modules serve two roles in Ruby. This shows one role: grouping similar methods together under a familiar name. Math also contains methods like sin and tan. Next is a dot.
What does the dot do? The dot is how you identify the receiver of a message. What’s the message?
In this case it’s sqrt(9), which means call the method sqrt, shorthand for “square root” with the parameter of 9. The result of this method call is the value 3.0. You might notice it’s not just 3.
That’s because most of the time the square root of a number won’t be an integer, so the method always returns a floating-point number. What if we want to remember the result of some of this math? Assign the result to a variable. Irb(main):007:0 a = 3. 2 = 9 irb(main):008:0 b = 4. 2 = 16 irb(main):009:0 Math.sqrt(a+b) = 5.0 As great as this is for a calculator, we’re getting away from the traditional Hello World message that beginning tutorials are supposed to focus on.