February 1st, 2003, 05:01 AM
A very basic *nix tutorial.
A very basic *nix tutorial.
Iknow hundreds upon hundreds of tutorials have been written on this but I would like to add my own.
The first thing you will see when you use *nix will probably be the login prompt. It will probably look something like the following:
When you login for the first time it will probably be as root. You have to remember that when you type you username you have to remember that it is case sensitive, for example: Root and root are entirely different names. When you press enter you will be presented with the password prompt. When you type your password in you will be unable to see what you are typing because echoing is turned off so that other people can't see what you are typing. While on the subject of users and passwords, the way to change your password is to use the "passwd" command. If you are changing passwords it will prompt you to enter your old one so it will know that you are you and not another person. When adding a user you use the "adduser" command, after you use it be sure to set a password! To delete a usre use the "userdel" command, when you do it use the "-r" switch to remove the home directory as well. To add some security to your system you will need to shadow your passwords by using "pwconv". If you are coming from DOS one of the coolest things about *nix is the ability switch between different consoles. This is accomplished by pressing Alt-F1 through F6. It will allow you to log in as multiple users if you need to.
If you will want to use *nix you will probably want to learn how to move around within the *nix filesystem, am I right? To see the directory you are in type "pwd" (present working directory). You will get an output something like:
/usr/exitrial (it will depend on what directory you are in at the time)
To change directories use the "cd" command. It works just exactly like DOS in this respect. Another command that may look familiar is "dir" it already diplays the results in wide format. It will look like "cd [pathname]". Typing cd with nothing behind it will return you to your home directory. Another important thing you will be doing is creating/deleting directories and deleting files. To create a directory use "mkdir [pathname]". To delete a directory use
"rmdir [pathname]. To remove files it is pretty close to the same command except it is just "rm".
To see what files are in a directory use "ls", one of the most important pieces of information you will know about a file is its permissions. To view the file permissions us the "-l" switch.
To see all of the files use the "-a" switch. You can combine switches within the same command if you want to.
ex) ls -al
A little bit on filepermissions:
type /owner|group|other/ #links /owner/ group /size/bytes/ date of mod. / name
--- / ----------------- / ---- / ---- / ----- / --------- / ---------- / -----
d / rwxr-xr-x / # / josh / users / 2004 / Jan 30 10:23 / html
the "d" means it is a directory.
In the permissions column "r" means read, "w" means write, and "x" means execute.
The number of links means...(need I say more?)
The owner is the person who owns the file.
The group depends on which one the owner is in.
Date of last modification: duh!
And of course you have the name of the file.
To change the permissions of a file use "chmod [perm#] [name]
to figure out what permissions you want to give the file you have to add the numbers together.
Alright lets say we want to give the user read and write permissions, the group read, and everyone else no access at all. The number will be 640. To give all permissions to everyone the number will be 755. Understand?
Viewing files is also another very important part of using an O/S. To view files in *nix use the "cat" command. It will display the entire file on screen at once. This tends to be annoying so I suggest piping it to "more". The command will look something like:
cat longlist | more
Or if you are say listing the files in a particular directory and you would like to save them use the following:
ls -al > [file to save to] (this can be used with other commands not just ls!)
If you would like to work through the command shell faster...
Whenever you type a command such as say emacs you don't have to type the whole command.
You can type "ema" and then press [tab] and it will finish putting in the rest of the command and all you have to do is press enter. You can also do this with pathnames.
One of the most helpful things about *nix is that it has an extensive online help system.
If you ever want to know more about a command use "man [command]" They may seem kind of cryptic but...well there is no but the just are!
When you want to see what stuff is running on your pc use "top" to kill the unwanted processes type k and the the pid number.
I know this is a really short tutorial, I am sorry it is my first. If you have anything to add or if you have any corrections tell me!