Top 10 Useful Terminal Commands

1/18/2012 4:15:00 AM
This post is going to be a first for me. I collaborated with a good friend of mine, an IT specialist who has worked in school districts as a Apple/Network guru for over 10 years, to compile some of the most useful terminal commands for an Apple user.  The terminal allows users to modify and perform tasks to their system that they can't normally do. These tips are nice for the novice user to get their feet wet in using the terminal.  While I've done some of this in the past I've always had help with an experienced user and would never mess around in the terminal unassisted. 

Disclaimer - It is never wise to use the terminal without knowing what you are doing first.  Be sure to have assistance or a reliable backup before performing such tasks.  We are only trying to inform people of some of the things that can be done and help users understand what is going on under the hood.

Top 10 Useful Terminal Commands
by Al McCoy - Apple/Networking Specialist
  1. man Man is a command which stands for manual. Not sure what command you need? You can try man -k and hope that you picked an appropriate keyword, if not, try another keyword until you find what you're looking for. Or give up and ask somebody smarter.
  2. sudo Allows your account to run commands as superuser (root), assuming you have admin privileges or have been added to the sudoers file by an account that does have admin privileges.
  3. du -cks /* | sort -nr -  Show how the files in utilize your disk. du -cks totals the sizes of all files and subdirectories inside the directory (e.g., /Applications, or ~/Desktop) in kilobytes, then sorts them from largest to smallest. Useful for finding what is filling up your disk. Use sudo if some of the files don't belong to you.
  4.  ls -al - Lists all files in the current directory assuming you have adequate permissions. Shows if each item listed is a directory, with permission, owner and group info for each file as well as info on the size, age and of course the file's name.
  5. pwd - Will print on the screen what directory the OS has you currently in, no matter how you got there.
  6.  cd  - Change directory. Useful tricks to know with cd - cd .. will move you to the parent directory, assuming there is one. cd ~ will take you to your home directory. cd / will take you to the root of the drive, everything on the drive is contained within /.
  7. su Allows you to switch to another account, assuming you know that account's password. This includes the superuser (root) account. Unlike sudo, which only runs the a command as root, su will switch you into root or some other account until you exit, giving you all the powers and restrictions of that account. Useful if you aren't in an admin account but know the name and password of an admin account, you can su to the admin account and then do admin stuff, including using sudo to do superuser stuff.
  8. whoami - So you're a whiz with su, you've been changing into other accounts all day, and suddenly you realize that you're not sure how many times you've exited, or to put it more succinctly, you're not sure what account you're in. whoami will list the current account, useful when things that you think should work aren't working because you're not who you thought you were!
  9. ping - This how you check that your computer can connect to another computer over the network. ping www.google.com should let you know if you can connect to google, or if you know another computer's IP address, you can do something like ping 192.168.1.1 (this is a common home router address, but may not be yours, so that one may not work for you).
  10. less - Less breaks up the results of some other command into screen size pages. This is done by piping the output of the other command to less (e.g.. ls -R | less) by placing the vertical bar or pipe character between the commands. Assuming that there is more than a single screen of output from the other command, less will show a : on the last line of the screen and pressing the space bar will advance to the next page. Some other useful keys at the : are return to advance a single line and q to exit less immediately. If less isn't available on your system, try more. As the old saying goes, less is more, more or less.

Here is another great list of Top 50 Terminal Commands from Mac Trips and Tips.

David Kapuler is an educational consultant with more than 10 years of experience working in the K-12 environment. For more information about his work, contact him at dkapuler@gmail.com and read his blog at cyber-kap.blogspot.com.
comments powered by Disqus
Tweets
Photo GalleriesView All Galleries >
Acer C720-2844 Chromebook

(www.acer.com) The Acer C720-2844 Chromebook model delivers speedy performance, a quick boot time of seven seconds, and a matte anti-glare display tha...

Britannica ImageQuest

(www.britannica.com) Britannica Digital Learning has upgraded ImageQuest, a resource for schools and libraries that provides nearly three million rig...

ClassFlow

(www.classflow.com) Promethean has released ClassFlow, a free, all-in-one, cloud-based teaching tool that lets teachers create and deliver interactive...

Adobe Voice

(www.adobe.com) Adobe has released Adobe Voice, an animated video app for the iPad that lets users create and share video stories. The app incorporate...

DeskBoard

(www.boxlight.com) The BOXLIGHT DeskBoard mobile cart adjusts both height and tilt for the P8 ultra short throw interactive projector on a white surfa...

Core 36M

(www.bretford.com) Bretford has introduced Core 36M, a 36-unit charging cart that is optimized for Chromebooks but which also supports most tablets, l...

Edmentum Sensei

(www.edmentum.com) Edmentum Sensei is a mobile optimized solution that helps administrators visualize and track overall school, teacher, and student p...

HMH Player

(www.hmhco.com) HMH has released HMH Player, a new native app for iOS and Google Chrome that streamlines the learning experience for improved digital ...

Juice Power System

(www.bretford.com) Bretford has unveiled an easy-to-use modular power system with exchangeable power components. The Juice Power System uses unique &#...

LightSail

(www.lightsailed.com) LightSail Education has announced a literacy accelerator that combines books with in-text embedded assessments and real-time dat...

myON

(www.myon.com) myON has expanded its digital library to include a set of literacy tools to further personalize the reading experience for students whi...

Nervanix Clarity

(www.nervanix.com) Nervanix has released Clarity, an application that monitors student attention levels as they study and guides them to revisit conce...

MathBall

(www.robotslab.com) RobotsLAB has introduced MathBall, a smart sensor basketball and tablet system that offers curricula in algebra, pre-calculus, phy...

MobileAsset.EDU

(www.waspbarcode.com) Wasp Barcode’s MobileAsset.EDU solutions include everything administrators need to account for their assets, from software...

OpenEd Assessment Creation Tool

(www.opened.io) OpenEd has announced a free tool that lets teachers easily create assessments with the question types required by Common Core standard...

Panasonic TH-80LFB70U

(www.panasonic.com) Panasonic’s TH-80LFB70U interactive LED display features high-speed, multi-touch, interactive capabilities to promote partic...

penveu interactive display system

(www.penveu.com) The penveu interactive display system is a handheld device that turns projectors and large screen displays into interactive whiteboar...

PresentationPro

(www.califone.com) Califone has updated its PresentationPro speaker. The PA310 readily connects with computers, LCD projectors, mobile devices, intera...

PowerSync+ Mobile Companion App

(www.bretford.com) Bretford Manufacturing, Inc. has announced the availability of the companion app for its PowerSync+ enabled charge and sync produc...

PureCharge Carts and Stations for iPad

(www.bretford.com) Bretford Manufacturing, Inc. has debuted the PureCharge family of iPad and iPad mini charging carts and stations. By offering pre-i...

ProQuest Research Companion

(www.proquest.com) ProQuest’s new information literacy product, Research Companion, offers videos that guide users through the research process,...

Sphere2 & Class Send Student Engagement Software Platform

(www.averusa.com) AVer Information has developed a Student Engagement platform, providing teachers and students with the tools to transmit document ca...

TabChargeCT2

(www.averusa.com) AVer has released the TabChargeCT2 charge cart solution, which can hold up to 40 Chromebooks, iPads, Android or Windows tablets, lap...

VoiceLift with Instant Alert and Emergency Video Monitoring

(www.extron.com) The Instant Alert function of the Extron VoiceLift Microphone, combined with a PoleVault, WallVault, or PlenumVault classroom AV sys...

SMART Board 6065

(www.smarttech.com) The SMART Board 6065 is an ultra HD, 4K interactive flat panel that offers collaborative capabilities while ensuring lessons run s...

Gaggle Unity Partner Program

(www.gaggle.net) The new Gaggle Unity Partner Program provides free data integration services for all educational technology vendors. Through the Gagg...

Waterford Early Learning, Reading, Math & Science

(www.waterford.org) Waterford Early Learning Cloud can be used at home or to supplement lessons in classrooms. It can also be used for individual adap...

NetSupport School

(www.netsupportschool.com) The latest version of NetSupport School allows teachers to monitor and collaborate with any mix of technology. An enhanced ...

Camtasia

(www.techsmith.com/camtasia) TechSmith’s Camtasia gives teachers the tools to record lessons, create videos, and engage their audiences. Educato...

Panasonic 3E

(www.panasonic.com) Intel has teamed up with Panasonic to announce the Panasonic 3E, which uses the Intel Education 2-in-1 reference design. Designed ...