13 Replies - 1348 Views - Last Post: 08 March 2013 - 01:45 PM

#1 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Best place to read documentation for Linux commands?

Posted 09 January 2013 - 08:55 AM

Recently at work I've been working with Linux exclusively running day to day operations and I'm in love with it. Pretty much anything I want to do is available as a command in terminal and that saves me massive time.

For example, just today. I have a huge 170GB .sql file that contains the mysqldump backup of a database. I needed to replace a string with another string inside the entire file, and guess what - there's a Linux program which you can invoke via the terminal.

sed 's|old|new|g' mysqlBackup.sql

Is that sweet or what?

I would like to know: what sites do you guru's recommend for Linux command documentation? Man pages are OK, but lack color and readability. I'd love something a bit more formatted. (inb4 man sed -pretty :lol:)

Is This A Good Question/Topic? 1
  • +

Replies To: Best place to read documentation for Linux commands?

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9187
  • View blog
  • Posts: 34,489
  • Joined: 12-June 08

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 08:59 AM

Moving to the linux forum.
Was This Post Helpful? 0
  • +
  • -

#3 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7730
  • View blog
  • Posts: 13,056
  • Joined: 19-March 11

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 10:08 AM

The man pages are generally the correct place to go if you want the raw details. For something like sed, you're coming close to talking about a language. I'd suggest you consult the O'Reilly if you want to go deep into it - sed & awk are covered in one volume.
Of course, you should be aware that anything that can be done with those tools can usually be done more simply in perl, but sed and awk have their charms as well.

I don't think there's a single point of contact for "unix commands" generally - if there is, I haven't found it.
Was This Post Helpful? 0
  • +
  • -

#4 Gorian  Icon User is offline

  • ninja DIC
  • member icon

Reputation: 120
  • View blog
  • Posts: 1,681
  • Joined: 28-June 08

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 10:19 AM

I created a bash resource thread here. They link to a lot of good resources for bash, and consequently, common linux command line programs and info.

also, FYI, you can browse man docs as you can vi. I.E. /<search term>. n for the next item in the search, etc.
Was This Post Helpful? 1
  • +
  • -

#5 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7730
  • View blog
  • Posts: 13,056
  • Joined: 19-March 11

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 10:36 AM

Oh, also almost every unix command offers some degree of interactive help, usually a list of available options and subcommands, accessed with a flag like "-h" or "--help".
Was This Post Helpful? 0
  • +
  • -

#6 Gorian  Icon User is offline

  • ninja DIC
  • member icon

Reputation: 120
  • View blog
  • Posts: 1,681
  • Joined: 28-June 08

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 10:43 AM

^ This. And again, if you want/need to, you can parse the help output with grep.
Was This Post Helpful? 0
  • +
  • -

#7 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 11:16 AM

Can you explain this bit?

Quote

you can parse the help output with grep.

Was This Post Helpful? 0
  • +
  • -

#8 Gorian  Icon User is offline

  • ninja DIC
  • member icon

Reputation: 120
  • View blog
  • Posts: 1,681
  • Joined: 28-June 08

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 11:22 AM

sure. Some commands have rather long output for help (I.E. yum). You can grep for the specific info you are looking for.

Example:

root@sprutil:~# cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output.

  -A, --show-all           equivalent to -vET
  -b, --number-nonblank    number nonempty output lines, overrides -n
  -e                       equivalent to -vE
  -E, --show-ends          display $ at end of each line
  -n, --number             number all output lines
  -s, --squeeze-blank      suppress repeated empty output lines
  -t                       equivalent to -vT
  -T, --show-tabs          display TAB characters as ^I
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit

With no FILE, or when FILE is -, read standard input.

Examples:
  cat f - g  Output f's contents, then standard input, then g's contents.
  cat        Copy standard input to standard output.

Report cat bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'cat invocation'



well, if all I care about it numbered lines, I can do something like this:

root@sprutil:~# cat --help | grep 'number'
  -b, --number-nonblank    number nonempty output lines, overrides -n
  -n, --number             number all output lines



and only see the lines of the help output I care about.

EDIT: Another option is to do this instead:

cat --help | less



piping your help output through less will pause the output and let you "scroll" up and down, and let you search it, like you can with mac.

This post has been edited by Gorian: 09 January 2013 - 11:24 AM

Was This Post Helpful? 2
  • +
  • -

#9 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7730
  • View blog
  • Posts: 13,056
  • Joined: 19-March 11

Re: Best place to read documentation for Linux commands?

Posted 09 January 2013 - 11:34 AM

*
POPULAR

If the help output is longer than you want, you can use grep to locate key words. For example

man grep gets a lot of information. If you just want to be reminded of how to get some context lines, you could do

man grep | grep context

which will remind you that the -A, -B, and -C flags will print lines After, Before, and Context lines (after and before). You can then use those commands to get more detail:


man grep | grep -C2 context

So that's not so easy to read. Maybe it would help if there were line numbers:

man grep | grep -C2 "line number"

Ah! much better:

man grep | grep -nC2 context

And you can pipe it through more or less (I use an alias: more is less) so you can scroll through it:

man grep | grep -nC2 context |more (or |less, if you're not aliased)

So now you have a few tools. Maybe you want to capture all of that in an alias:

alias scan="grep -nC2"

or you could even write a one-liner in bash to capture that whole line, so "scan foo bar" would mean "read the man page for foo and print out each line with the word bar in it, plus the preceding and following two lines, with line numbers, and pump it through more (or less)".
Was This Post Helpful? 5
  • +
  • -

#10 Lemur  Icon User is online

  • Pragmatism over Dogma
  • member icon


Reputation: 1359
  • View blog
  • Posts: 3,431
  • Joined: 28-November 09

Re: Best place to read documentation for Linux commands?

Posted 16 January 2013 - 11:44 PM

Fair warning, AWK and SED are pretty danged powerful and full featured languages all their own. I'd hesitate to call them BASH or Shell scripting in most cases. Definitely look into a book some time for those two, because once you realize the power of those two, regexp, and grep you can perform some serious voodoo magic.

Heck, one time I made a DSL out of those three to behave almost exactly like SQL in Unix class.
Was This Post Helpful? 2
  • +
  • -

#11 alexr1090  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 44
  • View blog
  • Posts: 124
  • Joined: 08-May 11

Re: Best place to read documentation for Linux commands?

Posted 23 January 2013 - 07:41 AM

View PostSergio Tapia, on 09 January 2013 - 09:55 AM, said:

I would like to know: what sites do you guru's recommend for Linux command documentation? Man pages are OK, but lack color and readability.

you can add color to the man pages. most, colored manpages,less colors for manpages.
Was This Post Helpful? 0
  • +
  • -

#12 alexr1090  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 44
  • View blog
  • Posts: 124
  • Joined: 08-May 11

Re: Best place to read documentation for Linux commands?

Posted 24 January 2013 - 10:52 PM

Also, you can find good documentation at tldp
Was This Post Helpful? 1
  • +
  • -

#13 AVReidy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 65
  • View blog
  • Posts: 431
  • Joined: 17-February 11

Re: Best place to read documentation for Linux commands?

Posted 08 March 2013 - 01:41 PM

Here's a decent cheat sheet
Was This Post Helpful? 0
  • +
  • -

#14 jon.kiparsky  Icon User is online

  • Pancakes!
  • member icon


Reputation: 7730
  • View blog
  • Posts: 13,056
  • Joined: 19-March 11

Re: Best place to read documentation for Linux commands?

Posted 08 March 2013 - 01:45 PM

The Free Software Foundation also has a good guide to the command line, which you can buy in paper or download for free. fsf.org, navigate to the "shop".
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1