Unix Command-Line Top 10

This post was kindly contributed by NOTE: Development With SAS - go there to comment and to read the full post.

If you are introduced to command-line Unix (or Linux or any other Posix-compliant variant) after a lifetime of Windows, it can be a daunting experience. To those thrust into this position, I always offer my top “ten” most useful commands to begin getting to terms (and getting on top of) the new environment.

  1. “pwd” and “cd” – when sat at the command-line, you must imagine that you are sat “in” a directory (“folder” in Windows-speak). All of your commands will be aimed at the directory in which you are currently sitting. To aim a command at a different directory you must either “move” to that directory, or specify the other directory’s name in the appropriate position within the parameters of your chosen command
    pwd – present working directory – tells you what directory you are currently sat in
    cd – change directory – move to another directory
  2. “ls” and “ls -l” – to see what files and subdirectories live within a directory, use either “ls” to see a simple list or use “ls -l” to get a detailed list that includes modify date, owner, and permissions
  3. “more” – if you want to see the contents of a file, more will do that for you. When you “more a file” you will see the first page of it and will then have the option of issuing further keyboard instructions:
    <space> – scroll down one page
    <return> – scroll down one line
    “q” – exit from more back to the Unix command line
  4. “grep” and “find” – use “grep” to search the content of files; use “find” to locate files with specific patterns of names
  5. “groups” – the “groups” command will tell you which security groups you are a member of
  6. “chmod” and “chown” and “chgrp” – these three commands respectively change the security permissions on a file, the individual owner of a file, and the group that owns a file (yes, in unix each file has two owners)
  7. “vi” – the much feared but ultimately powerful file editor
  8. “ps” and “top” – show what processes are running, and show the highest users of system resources
  9. “>” and “|” – Not strictly commands, but a most valuable adjunct to the use of commands, and one of the key features of Unix. The principle of Unix commands is to do one single task and to do it well. The principle of using Unix commands is to join the together by “piping” the output from one command to the next [to do]
  10. “man” – and if my brief explanations are not enough, view the pages of the manual with the “man” command
The foregoing is a vastly simplified description of the “ten” commands. Use the man command to find more information on each of them. The web is full of similar pages and documents with commands and how to use them, so there are plenty of sources for further information.
Are you an experienced Unix command-line warrior? What are your ten most frequently used commands?

This post was kindly contributed by NOTE: Development With SAS - go there to comment and to read the full post.