How to take first steps in learning the use of the CLI

Status
Not open for further replies.

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
I'm a hardware guy, plain and simple. I have built my machine with proper hardware
for FreeNAS and ZFS, but I have NO experience with non-windows operating systems.
With help from many of you, and some heavy reading, I've created a small pool to learn
a few basic things. So far, I have a few files copied to the machine and have managed
to configure a single user (me), three data sets, permissions and enabled a CIFS share.
To my great delight IT WORKS!
Now my next hurdle is to have my files and the storage space available off-site.
My research leads to me to believe a VPN is what I want to accomplish.
To have THAT, I must become comfortable with the CLI right?

My question is this...
If YOU were in my shoes and MUST do this (become somewhat skilled with the CLI),
where would you begin your "command line education".

Before you answer, please keep in mind, I make my living as a plumber,
but computers have been my VERY SERIOUS PASSION for almost 17 years!
Thanks for your responses,
BD
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
"Making your FreeNAS files available off-site" is really a huge no-no. If you insist on doing it, you WILL need a VPN, or you will be asking for trouble. Unfortunately, installing any reasonable VPN on to your FreeNAS is extremely (and I mean, EXTREMELY) advanced voodoo because of the way things work (it's hard to do on the FreeNAS appliance itself, and not recommended---and it's almost impossible to do in a jail because of how the networking works). So, the host that brokers your VPN will probably need to be something else.

Do you have other computers in the LAN (maybe some Windows computer), or a router with flashed firmware (openWRT, Tomato, DD-WRT), or any options like that? Setting up a VPN on those will be much easier.
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
Another option, if you're just occasionally getting a file here and there from off-site, is to set up ssh/sftp on the FreeNAS box. This is fairly easy to do, and we could guide you.
 

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
Another option, if you're just occasionally getting a file here and there from off-site, is to set up ssh/sftp on the FreeNAS box. This is fairly easy to do, and we could guide you.
Are you trying to dissuade me from a VPN? :( :D ;)
Based on your post, maybe I'm barkin' up the wrong tree here.
Forget all that VPN stuff, let's just say I want to become more
comfortable with the CLI as it pertains to freenas/freebsd/unix, etc.
If You did not have all your experience programming, where would you begin?
 

DrKK

FreeNAS Generalissimo
Joined
Oct 15, 2013
Messages
3,630
Well, what would I say. I mean there's a few choices that come to mind, depending on your best learning style:

1) If you're a reader, then there's any number of books on basic familiarization with the UNIX/Linux command line. I am sure 100 guys on the forum will be happy to tell you their favorites. You've got everything from the old, but still good, Unix for Dummies, you've got the FreeBSD Handbook itself (surprisingly readable in my view), and you can crank it up to something like this.

2) If you're a do-er, and not a reader, you might look at some of our guides on this forum. I have one, for example, on installing your own build of Owncloud (I am sure you'll find it), where (unlike other guides) I explain exactly why I'm doing everything. Cyberjock has a couple guides like that also.

3) You can surely find 10000 well-curated web pages that are designed for the new BSD user, with an intro to the CLI stuff.

I don't remember what I did, personally. I started hacking on Unix and VMS back in 1985 when I was in high school, and I think(?) I started by just getting a book from the library. Yes, yes that's what I did. So in my youth I was a reader. Nowadays, I'm more of a hybrid reader/do-er.

There's dozens of books that might be suitable.
 

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
Thanks DrKK, I like this one, after a quick glance, the review
comments seem to say 'for the beginner'. What's your opinion on this book?

I would like to hear the favorites of the other forum members as well.
Just remember, only recommend reading for "green as grass" beginners like me.

As a rule, I'm really not comfortable with learning (only) by doing, but will confess to some
timid (yet successful) do-er attempts to perform SMART testing of my hard disks via the CLI
and then figured out the commands for viewing those test results.

I don't feel like an idiot, but hanging with you folks makes me feel like someone who's learning
to walk upright among a group of world class sprinters :D

Brace yourselves for some noob questions over the coming months...
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
For me, everything I've learned mostly came from either the FreeBSD handbook or just by using the "man" command. You'd be surprised at how much information is stuffed in the man pages.
 

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
For me, everything I've learned mostly came from either the FreeBSD handbook or just by using the "man" command. You'd be surprised at how much information is stuffed in the man pages.
Thanks Whattteva! cool handle btw.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
I'll vouch for the Unix staple that are man pages.

Google is your friend when looking for help with specific commands - "*command* man page" is sure to yield useful results. It also beats reading the man page from the command line.
 

gpsguy

Active Member
Joined
Jan 22, 2012
Messages
4,472
If you don't already have SSH access to your box, you might want to set that up.

Rather than accessing the console from the server or via the webGUI, I initiate a SSH session using PuTTY running on my Windows box. A nice feature, is the ability to save the output to a file. So, when you execute the command to view the results of SMART testing, both the command and the output, will be included in your file. Save these for reference.

My style of learning, is read, do, and document. The latter, helps me commit things to memory.

As a rule, I'm really not comfortable with learning (only) by doing, but will confess to some timid (yet successful) do-er attempts to perform SMART testing of my hard disks via the CLI and then figured out the commands for viewing those test results.
 

cyberjock

Inactive Account
Joined
Mar 25, 2012
Messages
19,526
You know how I learned? I said to myself "I'm gonna start supporting the community so I'm gonna start figuring out problems for myself when people have them."

After that I was basically forced to learn. Make yourself use it and you will make yourself learn it. In many ways, that's better than a book.
 

Dennis.kulmosen

Explorer
Joined
Aug 13, 2013
Messages
96
My way of learning was that one of my old friends introduced me to some very basic commands like cd, cp, ls, mkdir, nano, df, chown and chmod. From that everything just came more natural. Everytime i started a project i started out in GUI in OS X but ended up in the commandline environment because of the ease and powerfullness. So now i start every project in the commandline using BASH or ZSH. So baseline is that if you have a project beside just learning, you will be forced to learn your way around the commandline. And google is your friend. :smile:
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
Although Jurassic-era in net time and written by a "'leet hacker" (not so 'leet, he got raided...) This "phile" is a surprisingly compact and very practical introduction to the UNIX CLI: http://www.pages.drexel.edu/~dat23/books/computers/unixhacktutorial.htm

I find it useful to hand out because it's written from the perspective of someone who didn't "grow up" with UNIX, DOS, BTOS, JCL and other CLI arcana.

Boot yourself a FreeBSD or Linux VM and have at it!

FreeNAS is not a great environment to learn the CLI in as it's a stripped down appliance and lacks many of the essential tools for a general purpose system.

Just ignore the aroma of teen angst in the file and you'll be fine... ;)
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
@OP: Just in case you didn't know. There are differences between Linux and BSD userland.
As mentioned in the introduction section of the FreeBSD handbook. BSD's are direct historical descendants of UNIX whereas Linux is a completely new rewrite.
This has some major implications (not an exhaustive list):
  • Licensing (GPL for Linux, Berkeley license for BSD as the name implies).
  • Linux generally uses run levels for its startup and shutdown sequence, BSD just uses a single rc.conf in conjuction with respective individual startup scripts. IMO, this is a much cleaner approach than run levels.
  • More consistent separation between userland and base system. BSD's generally keep stuff not part of the base in /usr/local, whereas Linux has no real consistency and tends to just put things wherever each individual program feels like.
  • Some variances with system utilities (netstat, pw, ifconfig, ip, etc...).
Those are some of the major ones I can think of at the moment. Obviously there are more than that.
That being said, both conform to the POSIX standards. As a consequence, if you're proficient on one, you should be fairly proficient on the other and vice-versa. There will be differences that you have to look up, but in general you should feel right at home with both.
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
@Whatteva & @OP: *THAT* is not even the first snowflake on the iceberg! The UNIX family of operating systems have a rich genealogy: http://commons.wikimedia.org/wiki/File:Unix_history-simple.png
Unix_history-simple.png

(Yeah, "simple" my eye!) ;) Consequently the UNIX "Rosetta Stone" has been around for years:
http://bhami.com/rosetta.html <-- Very Useful:cool:
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
Hehe, nice chart. Linux really doesn't belong in that chart though as Linux is NOT a part of UNIX family. It IS a clone of UNIX based on Minix, which conforms to the POSIX standards, but as even your chart clearly shows, there is no line whatsoever connecting the UNIX tree to the Linux tree. UNIX is mostly closed source (outside of BSD) while Linux is completely open source.

Also, for one of your questions:
My research leads to me to believe a VPN is what I want to accomplish.
To have THAT, I must become comfortable with the CLI right?
Not necessarily; In fact, if you have one of those DD-WRT/Tomato compatible routers, you could just flash it with the latest available ROM and it provides a very elegant and easy to use web GUI interface to set the server up.
It will set up the server, routing/bridging, and all the general heavy-lifting for you.
You may have to create the certs in a CLI, but that's just as easy as copy/paste several commands from a guide.
 
Last edited:

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
Just ignore the aroma of teen angst in the file and you'll be fine... ;)
read a bit of this and I hear what you're talking about lol.
you are right though, I see myself getting some good out of it, thanks
 

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
In fact, if you have one of those DD-WRT/Tomato compatible routers, you could just flash it with the latest available ROM and it provides a very elegant and easy to use web GUI interface to set the server up.
It will set up the server, routing/bridging, and all the general heavy-lifting for you.
You may have to create the certs in a CLI, but that's just as easy as copy/paste several commands from a guide.
I almost purchased one of these not too long ago, are you meaning this type of equipment?
 
Last edited:

BigDave

FreeNAS Enthusiast
Joined
Oct 6, 2013
Messages
2,479
@OP: Just in case you didn't know. There are differences between Linux and BSD userland.
As mentioned in the introduction section of the FreeBSD handbook. BSD's are direct historical descendants of UNIX whereas Linux is a completely new rewrite.
This has some major implications (not an exhaustive list):
  • Licensing (GPL for Linux, Berkeley license for BSD as the name implies).
  • Linux generally uses run levels for its startup and shutdown sequence, BSD just uses a single rc.conf in conjuction with respective individual startup scripts. IMO, this is a much cleaner approach than run levels.
  • More consistent separation between userland and base system. BSD's generally keep stuff not part of the base in /usr/local, whereas Linux has no real consistency and tends to just put things wherever each individual program feels like.
  • Some variances with system utilities (netstat, pw, ifconfig, ip, etc...).
Those are some of the major ones I can think of at the moment. Obviously there are more than that.
That being said, both conform to the POSIX standards. As a consequence, if you're proficient on one, you should be fairly proficient on the other and vice-versa. There will be differences that you have to look up, but in general you should feel right at home with both.
excuse me professor, what the heck are you talking about? Variances with system utilities???
this, sir, is the introductory class, dumb down please, WAY down :D
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
I almost purchased one of these not too long ago, are you meaning this type of equipment?
Yep, that is one of them. I actually happen to own one of those (earlier version, me thinks). Rock solid router btw: fast processor, lots of RAM, large ROM capacity.
I think you may actually not have to flash it at all if you get that one because ASUS ROM (surprise) is actually a custom-built version of Tomato. I did flash a customized version of it called (Asus-wrt IIRC), but the original version may already have OpenVPN server built into it. This, I believe is the more preferred approach than Tomato/etc. because Asus drivers seem to offer better wireless performance.
excuse me professor, what the heck are you talking about? Variances with system utilities???
this, sir, is the introductory class, dumb down please, WAY down :D
Hehe, sorry about that. It's not as complicated as you may think, here are a few examples:
  • pw (a user management utility) doesn't exist in most Linux distros.
  • ifconfig also doesn't exist in Linux, I think they use ip.
  • ps (a process listing utility) has somewhat different syntax (options use dashes for Linux and no dashes for BSD). Though I believe most of the utilities on both platforms implement both ways so you can use them either way on either platform.
  • Adding users to the system: useradd (Linux), adduser (BSD).
As you can see, they're mostly somewhat minor differences.

Additionally, you may also be interested to know that the term "Linux" actually refers to just a kernel, whereas "FreeBSD" is a completely fully functional base OS. Linux by itself is not terribly functional as a kernel without its userland can't really do much. Linux kernel is managed more like a dictatorship (Linus Torvalds has the final say on everything similar to Lary Wall with Perl), whereas FreeBSD is more like a democracy; There's a core team of developers that gets elected every 2 years.
Last but not least, the FreeBSD kernel and the base userland are developed together as one system. As a consequence, it integrates more consistently and cohesively. The system (arguably) tends to work better and more stably as a whole. Linux kernel, on the other hand, is developed independently from the rest of the userland. This is the main reason why you have so many "distros" in Linux world. The distros essentially take the kernel and wrap their own userland and create an OS out of it. The Debian project actually does this with the FreeBSD kernel also with their Debian/kFreeBSD project.

Anyways, sorry this became kind of long. Hope that helps.
 
Last edited:
Status
Not open for further replies.
Top