Termnial Commands

in macOS edited January 2014
I am extremely new to the CLI.... what can a newbie do with it? I'd like to know things like how to tell my uptime and other kinds of system info that I can only get through the terminal...

If I dont know what I am doing, how badly can i screw up my computer by playing with the Terminal? I'm sure I will ahve more questions later, but lets start with these

thanks for the help...



  • Reply 1 of 4
    first off, you're probably using tcsh [the default shell for osx]. so if you want to know everything, try `man tcsh`. that'll give you the manual. and you should read the manual cuz theres lots of questoins answered there. you can do that for a lot of commands (`man <command name>`). to get uptime, simply type `uptime`. to change directories, `cd [dir name]`. doing `cd` without a dir name, will send you to your home (/Users/<yourname>/).

    there is a danger on the cli, if you use `sudo` and `su`. if you do `sudo <other command>` then <other command> gets executed as root (after you type in your password). so that program will have full access over your comp. if you do `sudo rm -rf /`, you've empited your hard drive. (rm is remove, -r means recursive, and f means dont ask for permission). if you do `su` or `sudo -s` everything you do after that (until you `exit`) will be executed as root. you can tell that `su` or `sudo -s` is on because the prompt ends in a hash (#), instead of a percent (%). becareful with su and sudo, and only use them when necessary.
  • Reply 2 of 4
    If you don't use sudo or su, you probably can't do anything too harmful as you won't have permission to delete important system files or anything like that.
  • Reply 3 of 4
    nevynnevyn Posts: 360member
    The command 'man' is your friend. It is a daunting help system, but there's a lot of information on near everything. Make a _big_ terminal window then do:

    The command:

    man man

    Gives an overview of how to use the man command. Hit space to page to the next screen of text.

    All of the commands above have man pages also.

    "What does 'cp' do?" is answered by:

    man cp

    You don't need to wade through the 17,000 pages of crud - the synopsis at the very top gives you an idea... and generally there's some examples of common usage near the bottom somewhere. When you are using 'man' it sends the information through your default pager. That is either 'more' or 'less'. Um, seriously. So you can "man more" to see how to search through the man page.

    google for useful unix commands or intro to unix or whatever - - lots of information out there. Most of the user tools are similar, but 'BSD' howtos should be somewhat more appropriate.
  • Reply 4 of 4
    serranoserrano Posts: 1,806member
Sign In or Register to comment.