BSD General Commands

Is there a PDF file somewhere for the BSD General Commands that can be downloaded?

Mac mini 2018 or later

Posted on Jun 18, 2020 6:20 AM

Reply
40 replies

Jun 19, 2020 7:25 AM in response to BobHarris

BobHarris wrote:

A shell (back in the good old days) was a thin veneer between the user's fingers and the commands they would invoke. The shell put out the command prompt. When the user typed a command and then hit <return> the shell would do minimum parsing on the command (such as finding each word in the command based on the white space between them). It would look at the first word and see if it could find a program that had the exact same spelling. If it found a program that matched the spelling it would run the program and pass the remaining words from the command line to the program as arguments.

The shell would then wait for the program to finish.
When the program finished, the shell would output the command prompt and wait for the next command.

Again, simple program in the early days.

The basic concept remains, but the shell has more capabilities, but its primary job is to find programs based on the spelling of the first word in a command you enter.


Then , in essence, it's a mini-OS. Working like DOS, no GUI.


BobHarris wrote:

One of the things Unix did from almost the beginning was allow users to choose a different shell, which could have different rules, but more important, it allowed creative individuals to improve on the existing shell or invent their own. Those that became popular flourished.


The opposite of what Microsoft does, correct?


BobHarris wrote:

Also, I'm not sure the web page I pointed you at is all that complex. And since you said you were retired, you should take up a hobby. Learning the command line is an excellent hobby 🤪 

"Complex", in the case of the web page, probably depends on the reader's general knowledge. Just a lot more info than I'm currently looking for.


I like finding ways to make a job easier, which means learning the OS in addition to software. Most people I encounter don't care about learning either one. :-( When I learn or notice something that hadn't "registered" earlier, I usually want to know why. More on this at the end of this message.


As for a hobby, it's old and long gone railroads in this area. One of my "dream jobs" was to operate a steam locomotive. And I actually got the chance to that for 6 summers.  https://www.youtube.com/watch?v=6jg_qedH3i0 It's not the Union Pacific's Big Boy, but it was fun! If you want to skip the Corvair portion, got to 2:45 in the video. I'm the engineer and interpreter in the video.


BobHarris wrote:

But back to the original question, or maybe I should ask: "What is your goal?" Maybe there is some other way to approach it, and we could be helpful in that way, instead of teaching your all about the beginning of Unix back in the '60's and '70's.


The best question that could be asked!


Bought my first Mac in 2009, joined the Mac club, and have been attending the SIG groups meetings ever since. 1 of 2 meetings held each month.


At the last SIG, renaming and sorting files in Finder was the main topic. The presenter had a bunch if files that sorted as follows.:


Test1

Test2

Test3

Test4

Test10

Test11

Test12

Test20

Test21

Test22

Etc.


Wait!!! That's not what I learned years ago. It should sort as follows:


Test1

Test10

test11

Test 12

Test2

Test20

Test21

Test22

Test3

Test4


"Why?" popped into my head. I'm the one who asks the questions no one else thinks of or is interested in, so kept quiet. It was bad enough the meeting used ZOOM.


When I had the the time to pursue the "Why?", I wondered how the files would sort in Terminal. I fooled and fussed and pharted around enough to discover the ls command, and displayed the files with the correct path.


UH OH! I expected a single column of filenames as you get with the DIR command in DOS. But no, Terminal gave me rows and columns, like a spreadsheet. Do I read left to right, top to bottom, or top to bottom, left to right?


After a bit of reflection, I thought there was probably a way to tell the ls command to display the files in a single column. But how?


Somehow, all this got me a manual page for BSD General Commands and it immediately occurred to me the answer was probably in this document somewhere. If I could only print it out and have it all in one place at the same time...


And, here we are. Back to my original post. In lieu of a PDF file to download, how about a way to just print the file(s) from my hard drive? And all of then in a single PDF file. Surely that is possible. :-)


Off topic, but it really frustrates me about Apple not telling you of everything that is on the computer when you buy it. Curl being one of them.

Jun 21, 2020 4:02 PM in response to snowshed

And I found this via Google


Here is a trick to open a man page in Preview

man -t command_name_here | open -f -a /Applications/Preview.app


for example

man -t curl | open -f -a /Applications/Preview.app
man -t ls   | open -f -a /Applications/Preview.app

You could then have Preview "Print to PDF" and you would have a PDF copy of that man page.



And here is a command that will send the man page to your default printer


man -t command_name_here | lp


That is el p as in Line Printer, and it will send the man page specified to your default printer as specified in System Preferences -> Printers & Scanners.


for example:

man -t curl | lp
man -t ls   | lp


You can use the 'apropos' command to get a list of man page for various commands in sections 1 and 8. Section 2 is operating system calls. Section 3 is programming library calls, Sections, 4, 5, 6 & 7 are various structures and other misc information that a programmer might like


apropos \(1\) \(8\)


If you want to script this, you had better have a lot of printer paper and ink, because a lot of junk is going to come spewing out.


Here is a sample script. Warning: I DID NOT run this script as written, as I have no intention of printing out all the man pages 🤯

apropos \(1\) | while read cmd
do
    cmd=${cmd%%(*}
    echo $cmd
    /usr/bin/man 1 $cmd | lp
done

apropos \(8\) | while read cmd
do
    cmd=${cmd%%(*}
    echo $cmd
    /usr/bin/man 8 $cmd | lp
done


Personally, I DO NOT recommend you run this script.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

BSD General Commands

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.