Command Line?

unlearnthetruth

Recycle Me!
lets say i download a command line app..... how would i umm...... go about.... well.... running it? I know nothing about the terminal, except "banner" and how to get to the emacs games :rolleyes: I'd like to learn how to do useful stuff, but i don't even know where to look, and the man pages in terminal aren't very helpful. So can anyone either fill me in on the very basics, or send me somewhere that will?

Thanks!
 
well, although this will highly depend on the application, here are some general rules:
First, download the program (duh). Try and download it so that stuffit doesn't decompress it - stuffit sometimes messes up filenames and stuff.
So, after its downloaded, get into the terminal.
I'll use '%' as the shell prompt caus its alot easier to type than '[localhost: ~] unlearn%' or whatever your prompt is.
%cd ~/Downloads
(this changes directory to a folder in /users/MyUsername/Downloads - change it to wherever you downloaded the app to).
%gunzip myapp.tar.gz
%tar -xvf myapp.tar
(yes there is a way to do that all in one step, but I honestly don't know it.. maybe its tar -xzvf... not sure).

next, cd into the created directory:
%cd myapp
now, take a look arround:
%ls -F
The -F makes your ls binary mark the files as either @ (simbolic link), *(executable) or / (directory). I find it very usefull.

At this point you have to figure out if the program is 1) precompiled binary, or 2) sourcecode. Its probably 2. If you arn't sure, just look for the presence of a file called 'configure' or 'makefile.in'. (Its also posable that your download is a perl file or something like that - thats another story...)

If you really want to get into it, type:
%file *
this will attempt to identify each file as to what it is (such as lsb-x86 binary, mpeg-2 stream, bash shell script, ascii data, etc).

Now I recomend reading all the documentation it came with, except for maybe the release logs and stuff like that.

%cat INSTALL | more
The '|' is called a 'pipe' and directs the output of the first command (cat INSTALL) into the input of the second command (more) (the pipe is the key direectly above the return key on most apple keyboards). This is needed because its quite likely that without the 'more' command, the text will 'outscroll' the terminal and you'll have to either scroll up or scroll up and increase your scroll buffer.
Once you have typed that, press return for the next line, space for the next page, and b for the previous page. / is the command to search - just type /compile to search for the word 'compile' in the file. Press q to quit the more command.

you'll probably also want to read the readme :)
%cat README | more

ok, so now you're read them. Here's what they will probably tell you to do:
%./configure
(the ./ makes your shell look within the current directory (called .) for the file 'configure').
configure, or sometimes Configure will create a file to tell your compiler how to compile and install the program.
You may get errors at this point (which is where macosx.com comes in handy :p)
next, its probably time for:
%make
'make' reads the Makefile, and directs your c compiler as to how to compile the program, and where to find the needed libraries and stuff.
This may take quite a while, depending on the complexity of the application you are compiling.
next, do this:
%sudo make install
Now enter YOUR password. If you are not logged in as an Admin account, sudo will fail - you gotta be in the 'wheel' (aka admin) group to sudo.
sudo lets the make program install with root privs. This is needed caus some of the directories on macosx are root-only, and can't be written to otherwise.

At this point, the application is uncompressed, configured, compiled, and installed. You can now remove the directory you downloaded it in, although I wouldn't untill I verify that it works.

most likely, the program will be installed into your path ($PATH that is). This means the shell will know where it is, and you can just type the name of the program from any directory and it will run.

Glad you had the guts to ask this question. If there is anything else I can help you with, please don't hesitate to ask!
 
i found a version of bitchx in .tar.gz format. after i did gunzip and tar it made 3 files: BitchX, scr-bx, and wserv. there is no directorie, install file, or readme. i tried ./configure, make, and make install on each file but i got nothin. thanks for help.
 
as far as I know, .tgz means .tar.gz. Just rename it if it doesn't work. Seriously, some of these unix apps are dumb and look at the file name and say "Uhh we don't service those here" :)

mv file.tgz file.tar.gz
then do the regular gunzip and tar routine.

btw, if you get bitchx working, let me know - I tried it for two days and just could not get it to compile. Something about abot.c or something.. wouldn't compile.
 
Yes, tgz is the same thing as .tar.gz. In this version of tar (and GNU tar) the 'z' option will use gunzip, so you can do it in one step, 'tar zxvf'.

Not sure what the problem with BitchX was, but maybe you got a weird or bad distribution?
 
Back
Top