Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

fab5freddy

macrumors 65816
Original poster
Jan 21, 2007
1,206
7
Heaven or Hell
i am currently learning Linux commands, and was wondering if they are the same as unix / darwin commmands ? so i could use them in Terminal ?

thanks!
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
Depends on the command. In most cases they are very similar. Check the man pages to be sure behaviour is the same.
 

jsw

Moderator emeritus
Mar 16, 2004
22,910
44
Andover, MA
Also be sure you're using the same shell (bash, csh, etc.), as that will affect a number of things as well.

I agree with antibact1 - most commands work the same way.
 

savar

macrumors 68000
Jun 6, 2003
1,950
0
District of Columbia
i am currently learning Linux commands, and was wondering if they are the same as unix / darwin commmands ? so i could use them in Terminal ?

thanks!

Most of the "commands" are actually just programs. When you type "ls", for example, you're running a program which figures out your current directory, then goes to the filesystem and prints out all the file names.

So by tradition most of the commands are the same because people building the different variants of unix and linux didn't want to re-learn a bunch of new commands.

Having said that, there are places where the new designers thought they could do it slightly better, and this is where most of the differences between these OSes arise from. The most evil consequence of this is finding that commands are named identically on two different systems, but actually behave slightly differently.

To offer one random example: on my Mac (and most linux also) I can use the "-R" flag in grep to search recursively, but on my Solaris server at work grep doesn't support this flag.

The bright side of things is that since most of this stuff is open source, if you find yourself missing a command that you learned/used somewhere else, you can try to find the source code and compile it yourself.
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
There isn't really a best shell per-se, just different ones. The default OS X shell is bash, but also available is csh, ksh, tcsh and zsh. Common on Linux is bash, so you may want to stick with that if you are doing any shell programming.

Keep in mind, unless you are writing shell programs, the particular shell you are using isn't to have any effect on the program (ie. ls is ls regardless of the shell). With that said, things such as output redirection vary depending on the shell.
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,776
15
Grand Rapids, MI, USA
Keep in mind, unless you are writing shell programs, the particular shell you are using isn't to have any effect on the program (ie. ls is ls regardless of the shell).

Even then, isn't it fairly easy to define the shell at the beginning of the script, using a line like:

#!/bin/bash

And also good practice?

I also think it's best to stick with bash, though... it doesn't seem like it's quite so common for OS X users to switch around between shells as it is in other *nix environments.
 

antibact1

macrumors 6502
Jun 1, 2006
334
0
Even then, isn't it fairly easy to define the shell at the beginning of the script, using a line like:

#!/bin/bash

And also good practice?

I also think it's best to stick with bash, though... it doesn't seem like it's quite so common for OS X users to switch around between shells as it is in other *nix environments.

Using #!/bin/bash is definitely a good practice. A lot of people use #!/bin/sh which is commonly a symlink to the default shell, so there is no way to know what you're getting.
 

cube

Suspended
May 10, 2004
17,011
4,973
Terminal runs a shell. You define the default shell in the user account.
 

cube

Suspended
May 10, 2004
17,011
4,973
ok, so what should i choose in Terminal prefs ?

Scripting is different from interactive use regarding what you find more practical, so it's a personal choice.

Personally, I can't stand the normal Unix shell syntaxes, so I prefer scsh for any nontrivial scripts, but I just use bash or tcsh interactively.
 

cube

Suspended
May 10, 2004
17,011
4,973
Besides some little place which is amateurish about this issue, they will require years of experience as a Unix/Linux administrator (not developer).
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,776
15
Grand Rapids, MI, USA
ok, so what should i choose in Terminal prefs ?

Terminal prefs just controls the way the window looks -- how many lines, is it transparent, what is the default font / color / size, does the cursor blink, etceranda. It has nothing really to do with any of this. If you decide to stick with bash, you don't do anything. You're already in bash. If you decide you want to change the default shell, this tutorial explains that and a wealth of other things:

http://www.macdevcenter.com/pub/a/mac/2005/05/20/terminal1.html

So it's a good place to start. :)
 

cube

Suspended
May 10, 2004
17,011
4,973
Terminal prefs just controls the way the window looks -- how many lines, is it transparent, what is the default font / color / size, does the cursor blink, etceranda. It has nothing really to do with any of this.

The preferences in the Terminal allow you to override the default shell.
 

cube

Suspended
May 10, 2004
17,011
4,973
About how people start: sometimes developers get part-time admin duties in some small place, there are also interships, or maybe you could get even a junior position.

Getting a PC with OpenSolaris or Solaris Express and this would help.

Or also this.

But the courses are not cheap. Maybe you should look in Amazon for certification guides.
 

mkrishnan

Moderator emeritus
Jan 9, 2004
29,776
15
Grand Rapids, MI, USA
You can't be serious.

I think that's the place to start to become a sysadmin... not the place to start to just use Terminal. ;) :eek:

My response had (hopefully clearly) been more about how to get started using terminal commands in OS X. I don't think that tutorial will make anyone ready to be a sysadmin. :D
 

sfisher

macrumors regular
Jun 20, 2007
101
0
Albuquerque, NM USA
Using #!/bin/bash is definitely a good practice. A lot of people use #!/bin/sh which is commonly a symlink to the default shell, so there is no way to know what you're getting.

/bin/sh either gives you the traditional bourne shell or the bourne again shell (bash). Bash is backwards compatible with sh. I have never seen a system that gives you anything else.
 

SC68Cal

macrumors 68000
Feb 23, 2006
1,642
0
My response had (hopefully clearly) been more about how to get started using terminal commands in OS X. I don't think that tutorial will make anyone ready to be a sysadmin. :D

True, I make no argument that my post was actually worth the storage in the database. :p
 

fab5freddy

macrumors 65816
Original poster
Jan 21, 2007
1,206
7
Heaven or Hell
hi SC68Cal, just wanted to ask you about what skills you need to get a job as a system adminstrator / server administrator ?

what should i learn first Windows Servers or Linux / Unix Servers ?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.