What are some things that can be done in the terminal?

Posted:
in macOS edited January 2014
I was just wondering how to do some cool stuff the terminal.

Comments

  • Reply 1 of 3
    chychchych Posts: 860member
    You can run command line programs in the terminal, that's about the coolest thing about it.



    The most common programs I use are:



    ssh - log on to remote hosts

    top - list processes/cpu usage/memory usage

    ps - list processes

    lsof - list open files

    ftp - use command line ftp program

    man - manual page for a program

    rm - delete files

    cd - change directory

    ls - list current directory



    But there are a ton of programs, just hit tab-tab to see them all (if you're in bash). You can also install more programs, fink is especially good for that.
  • Reply 2 of 3
    baumanbauman Posts: 1,248member
    Here are some useful commands that are rather basic.



    See everything that's running (including background processes):

    ps -aux



    Check all network connections to your computer:

    netstat -p tcp



    Check your uptime:

    uptime



    Check your current system stats:

    top -u



    Do an incredibly fast search for some file on your hard drive (uses a cached database that can be several days old):

    locate some_file



    Find all lines in some_file that contain the word foobar:

    grep foobar /path/to/some_file



    Take this_file, and replace all instances of the word foo, and replace it with the word bar, saving the result to that_file:

    sed this_file s/foo/bar/g > that_file



    Find a command that does something:

    apropos something



    Look up what some_command does:

    man some_command



    If you have the developer tools installed, then you can:

    Make a file invisible:

    /Developer/Tools/SetFile -a V /path/to/some/file



    Get Fink and install all sorts of fun command line and X11 apps.



    There's much more, but this should give you a start.



    Edit: Oh, and there's also the text editors... pico, emacs and vi (listed in difficulty to learn). Pico is rather simple, but Emacs is more powerful. Try out the tutorial in emacs.
  • Reply 3 of 3
    ast3r3xast3r3x Posts: 5,012member
    Ok, I have to warn people because I'm not that bad of a person. Do not do that, type in anything close to that, or even look at it for that matter. Never use sudo, su, root or type anything that increases your privileges unless you know what you are doing.
Sign In or Register to comment.