Posted by Mo J. Al-Mughrabi in
Featured Articles,
Software on 11 6th, 2009 |
11 responses
Terminal is my number one tool when am Mac’ing. All the time, I have to have it running, for users who like to get some taste of Mac CLI power. Well, terminal is extremely useful and you can get a lot done.
I personally think terminal is great to keep an eye of the processes on your Mac, for me, I also have several Unix/Linux boxes that needs me to administrate every now and then. Which is something I could do natively from the terminal, I also use it to test for open ports, list listeners on my own machine. You would be surprised how much you can do with it.
- If you ever used force quit, you might think this is really a prompt way to kill a process. Unlike with windows task manager, force quit would take take few seconds to terminate a process. When you are using a terminal, its a whole different thing. With – killall AppName – its will instantly kill the what every application you replace with – AppName – for instance, killall VLC, will immediately terminal VLC player if it was running.
- List all open ports on your machine, this could be extremely useful at sometimes. It will show you if any application is opened to the public to access it and if yes, on which port it is opened. Therefore, you could either terminate unwanted processes or will help you know where you installed your database server for example.
sudo lsof -i -P | grep -i "listen"
- The top command, simple and genius invention. Simply, it will list all the processes on your mac, sorted by most consuming CPU first. If you run top and monitor for a minute, you will see processes jumping up and down in the list order. Its a great way to see how much each program/app/process is consuming memory/cpu. If you want to exist from the top, you just hit q.
- Get a view of your consumed disk space, Its really fast and efficient, try – df -h – its well known command in the linux/unix world. Will get you an instant view of your file system status including any hooked up drive, USB’s, DVD or CD drives.
- Listing your file system in a hierarchal view including hidden folders. Sometimes I use it to get a quick view of what lays underneath a certain folder, It could be a hassle to go on and click them one by one and see what is there. This command will save you the trouble and list everything in a tree like view.
ls -Ra | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
Well, I guess that’s it for the week,
See you all next friday,
I’ve never used Terminal, nevertheless, those commands seem to be useful and easy to implement. I guess I’d give a try to a couple of them in sha’a Allah.
Thanks for your sharing…
The sed command is exactly what I’m looking for…
@Angel: Yeah, well, you can make good use of some of those commands specially the “top”, it can be helpful to know what application stresses your mac the most.
I see, thanks again dear…For knowing what application is heavily using my system resources, I used to check it with the Activity Monitor, would that command in Terminal do the same task as the Activity Monitor does…?!
Yeah its exactly the same, accept that Activity Monitor for n00bs and top for pros
hehehe…e7im!
I see, hmmm, guess then I should get myself more into the pro side.
For a nontech guy like me, I’m even afraid to open the terminal, moreover do something on it. But who knows, maybe in the near future if I’d learned and had enough knowledge about that coding stuff(from here), then I will more than willing to do some experiment. So, please keep on sharing.
I didn’t even try this command
sudo rm -rf ~/.Trash/*
on the terminal when I had difficulty removing trash(on the bin), instead I called the *geeky guy who do the job for me. lol
btw, great info… Thanks!
@Angel: Plus, top is a universal command, you can use it with Mac, all linux distributions, unix and Solaris. In fact, most the command lines I use in my Mac, I learned them from using a Linux box or Solaris.
@Nad: command line is geeky? lol,, You know? there is people out there, they use command lines to render images and do actual image processing, that what I would call geeky
.. but, yeah, perhaps you can start with the basics and never try to use sudo commands unless you are confident. Other commands, cannot cause much hard to your machine but it could cause to your data
… thanks for the comment btw, its good to read from you here…
I used to have that geeky passion to learn stuff like that and do things from the command line, but with time, I grew to simplify things all over my life from inside out…
@ Mo: Sorry about that *geeky stuff… heheheh what I mean is the guy who actually looks geeky(glass with thick lenses)… I think those people who rendered and processed images using command lines are pure genius!
yeah! you\’re right, sudo commands, if wrongly done can cause damage on your data (maybe you can add some warnings here for those nontech guys like me, lol). and lastly, I always directly dive on the other inside, didn\’t know that some gems are also found here…
@Angel Soul: me too! I like simple things..
@nad: hehehe, yeah! Viva Simplicity!