Terminal OS X on sageli, minu arvates niikuinii, tähelepanuta ala operatsioonisüsteemi. Enamik uustulnukad Mac vaadata seda hirmu, kui silmist midagi koodi seotud või täiustatud on piisavalt, et neid maha elu. õnneks, you don’t have to be scared of Terminal and think of it as a feature just for the tech-minded. Knowing some basic Terminal commands can really enhance your experience of OS X. nii, for all the beginners out there, here is my pick of the top 10 Terminal commands that every Mac user should know.
Before We Start…
Before we start tinkering around with it, it is probably worth taking a couple of minutes to tell you exactly what Terminal is (all in a non-technical sense, muidugi!).
Terminal (officially called Terminal.app) on, strictly speaking, an emulator and works off most typical UNIX commands (OS X is a UNIX-based system, as opposed to Windows, which is NT-based). Unlike OS X, which has a graphical user interface (shortened to GUI), Terminal works off a text-based interface and all commands have to be typed in – this may be the reason why some people are scared off by it!
We won’t go into massive detail on how Terminal works but it’s best to learn the following three commands before we start this tutorial:
- ls – list the contents of a particular directory
- cd – change to another directory (as in DOS)
- sudo – authenticate yourself a superuser to gain extra security privileges
ots: >Be extra careful when using the sudo käsk. You will usually have to enter your OS X system password and any mistakes can permanently mess up your system for good. When in doubt, leave it out!
1. Disable Lion/Mountain Lion’s Pop-up Accent Window
For people like me who write a lot of foreign accents then the pop-up accent window that came up when you hold down a letter for a longer period is extremely useful. But for those of you who want to write lots of repeat letters, it can be quite annoying. Use this simple trick to disable it:
Hit Return then log out then back in again to see the changes. If you want to change back to the norm, then simply substitute false jaoks tõsi in the above.
2. Change the Default Backup Periods in Time Machine
Vaikimisi, Time Machine backs up every hour when it’s connected but this can be changed through Terminal. Selleks, simply enter the following command:
This makes Time Machine backup now every 30 minutit. To change it to what you want, simply replace the 1800 with the interval time in seconds (nii 15 minutes would be 900 seconds, therefore enter 900). Also be aware that you are using a sudo käsk, so make sure that you’ve typed the command exactly right before you hit Enter (and you’ll also be prompted to enter your system password).
3. Drag Dashboard Widgets onto the Desktop
I always forget that the Dashboard exists on my Mac. Tegelikult, I hardly ever see a need for it. But I think that’s mostly down to the fact that the widgets are hidden away inside the operating system. To be able to drag your Dashboard widgets onto your desktop, then enter the following command:
You must log out then back in again and to drag a widget onto your desktop click and hold down on it then press F12, which dismisses it from the Dashboard and allows you to drop it onto the desktop. Your widgets now float above open applications, similar to the Gadgets on Windows 7.
To disable this feature, simply replace YES koos NO in the above command. uuesti, you’ll have to log out then back in again, unfortunately.
4. Disable Lion/Mountain Lion’s Auto-restore Feature
This really bugged me when I first upgraded to Lion – the fact that when you open up something like Preview, all your recently accessed PDFs coming popping up in your face, even if you closed them down properly. Unfortunately there’s no universal command to disable it across the entire OS so you’ll have to do it for each individual program. If you want to disable it for Preview, then enter the following command:
QuickTime is another culprit in my eyes, again just enter:
Make sure you quit and restart the apps to see the changes and if you want to reverse anything, simply substitute false jaoks tõsi (I’m sure you’re getting the hang of this by now!).
5. Show Hidden Files in Finder
Vaikimisi, the Finder in OS X hides some files away from view (mostly irrelevant ones) but if you want to see everything on your computer, then enter in the following command:
uuesti, substitute false jaoks tõsi to hide them again.
6. Change the File Format for Screenshots
Screenshots using the built-in shortcut for OS X are really useful but by default they are saved as PNG files. If you want to change this, then type in the following command:
Replace file-extension with the three letter abbreviation of your desired file format, so for JPEG format simply enter JPG and for Acrobat PDF format, PDF. Terminal doesn’t have to be difficult, does it?
7. Kill the Dashboard Altogether
Above, we went over the command to drop Dashboard widgets onto the desktop, but if you want to get rid of the Dashboard altogether (näiteks, if you’re running an older Mac and have memory issues) then you can do via this simple Terminal command:
siis, restart the Dock using the following command:
Et, voilà! No more Dashboard. If you find yourself afterwards lamenting after the good old days, asendamaYES koos NO in the top command and repeat the process.
8. Securely Erase Free Space
When you delete files on your Mac, OS X still leaves fragments of the file all over the free space on your hard disk drive, until these are written over by new files. If you want to securely delete all the remaining fragments on a hard disk drive (for example if you’re going to sell your Mac), then execute the following command:
Replace /name-of-drive with the drive you want to erase. This command uses a special algorithm to wipe over each free area of space 35 korda, far above the US Department of Defense’s standard, which only requires 7 passes. Be aware though that this process can take days on larger drives.
On a side note, the command diskutil is a really useful one and allows you to manage local disks and volumes directly from the Terminal (a list of sample commands is given). Be aware, kuigi, that most commands require root access.
9. Control Your Mac Remotely
Being able to control your Mac remotely via SSH, or secure shell, is far more advantageous than screen sharing as it uses less system resources and less bandwidth. The first thing you will have to do is enable Remote Login on your Mac, which you can do by heading over to System Preferences then Sharing then click on Remote Login.
A little green light should come up, along with an IP address that you can use to log in via Terminal. The connection between the local Mac you’re using and the remote one (st. your own one) is secure and encrypted, meaning that any data being transferred between the two cannot be intercepted.
To log into your Mac on another Mac, execute the command:
ssh -l username remote-address
Replace kasutajanimi with the username you’d use to log into OS X and remote-address with the IP address given to you in the Sharing pane. You can now control your Mac and execute Terminal commands remotely, a real plus.
10. Talking Mac!
And last but not least, if you want your Mac to speak to you, then simply use the ütlema käsk, as in:
The words will be spoken in your Mac’s default voice but if you want to change this, then simply head over to System Preferences then either Dictation and Speech (on Mountain Lion) or simply Speech (on Lion). Here you can select different voices and download new ones from Apple’s servers if you fancy. Another “useful” feature is the ability to convert an entire text file into speech, if you so fancy. Simply enter:
Replace FILENAME.txt with your own file. This will create a reading of your file as an AIFF file audio.aiff in Terminal’s default directory.
ots: Ever wondered if the Mac operating system is pronounced “OS ten” or “OS ex?” Your Mac knows the answer! Try typing “say OS X” into Terminal. The result may surprise you.
I hope that this little tutorial has helped you demystify the Terminal and realize that it’s really not that bad to use – you can achieve a lot more using it and if you want to customize OS X beyond simply changing the wallpaper, then it really is your first port of call.
I hope you have plenty of fun with the commands mentioned above, please feel free to share your own favourites in the comments section below for the benefit of all Mactuts+ readers!