1. Foder Structure In Linux
As Windows has its own folder structure (eg: \ Windows, \ Program files, \ Document and Settings), on Linux also has its own file structure. Here are the existing folder structure on the Linux
/ = root
|-bin = binary
|-boot = kernel save
|-etc = configuration files
|-home = user data file
|-lib = library
|-usr = application
|-var = mail / log / database
|-mnt = mount-point
|-tmp = temp
|-sbin = binary super user
2. Installation Preparation Linux (Mandriva 2006)
- Media for insallasi can be: CD / DVD, HDD and Network (ftp, http, nfs)
Partition in Linux, at least consists of two partitions, namely:
- A / (root)
partition is used as a system of Linux itself. Partitions can be of type: ext3, ext2, reiserfs, etc.. I recommend using ext3 partition type, because it is journalized FS.
- Partition swap
partition is used as virtual memory, if there is insufficient RAM. The recommended minimum size is 2X the size of RAM, but if your RAM in the upper 1 GB, there should be 2X the size of RAM.
- Home partitions
Partition home is not necessarily there, but I suggest to make this partition, because the existence of this partition, then your documents will be separated from the / partition (root). What are the benefits? When you re-installed Linux, or switching windows, then your data will not be lost. This is just the same as you create 2 partitions in Windows, namely the partition for Windows and partition for your documents. Home partition can be of type ext3, ext2, reiserfs, etc..
- For those of you who use CD / DVD to install Linux, then you can simply boot from the CD / DVD to perform the installation. Because the CD / DVD is bootable Linux in general
- But for those who want to install via network (network), you simply create a boot disk or bootable Flash Disk. Making boot disk should be done on a computer that has installed Linux. Here's how:
- To create a boot disk, and network_drivers.img network.img necessary files. To create a bootable Flash Disk, is required all.img file. Usually the files are located in the install directory / images in the CD / DVD Mandriva Mandriva or directory located on the server.
- Copy the file to a floppy disk or to flash disk, the way is as follows:
- For floppy disks, please first floppy disk format. This is to avoid the errors that occur on the diskette. How to format a floppy disk, type in Console: mformat a:
- Then, the image that has been made should be copied to a floppy disk or flash disk. For floppy disks, copy the image with the command:
$ dd if = network.img of = / dev/fd0
$ dd if = network_drivers.img of = / dev/fd0 Network.img to a diskette (Diskette boot) and network_drivers.img to disk 2.
For flash disks, copy the image with the command:
# dd if = all.img of = / dev/sda1
Note the sign of $ and #. $ Sign, it means you are logged in as a normal user, while the # sign means that you are logged in as root.
- After the floppy / flash disk booting is finished, you just boot the computer using a floppy or flash disk, then just follow the instructions. How to install it please refer to another thread.
3. Basic Linux Commands
Description:
Linux Command = Command Description DOS = command
- ls = dir = browse files
- clear = cls = clear display on the monitor screen
- cp = copy = copy files
- mv = ren, move = rename the file, and it could be to move files to specified directory
- cd = cd = change directory (if no parameters will go to the home directory)
- mkdir = md = make directory
- = rd = rmdir remove empty directories
- cat = type = browse files
- rm = del = delete files or directories
- pwd = cd = see the current active directory
- more = more = view per page
- grep = <<no ada>> = filter or view files based on specific words
- free = to = view memory information
If the DOS to display the description of a command use
/? , then Linux can use the command
man .
Example, to know the function of the ls command, then it can use
man lsTo display a list of commands in linux, use the command info .
Some examples of use Linux basic commands:
- Displays a list of file or directory ls-a = View all the files or directories, including hidden (starting with the sign. (point)) ls-l = Displays the files and directories in a complete display, including size, modification date, owner, group and mode attributes ls-R = Menapilkan all files or directories. If there is a directory, the directory's contents will be displayed as well
- Create a directory several levels within a command. An example directory has a structure like this:
Computers
|-Hardware
|-CPU
|-Memory
| HDD-
|-Software
|-OS
|-Office
- Then you can use the following commands:
$ mkdir-p Computers / {Hardware / {CPU, Memory, HDD}, Software / {OS, Office}}
- To see its structure, use the command tree (if no, first install the tree with his command urpmi tree )
- To delete a directory Computers including underneath it (in DOS using a command deltree ), use the command
rm-rf $ Computer
-rf Parameter means is to remove all directories that are in it (-r) without asking again (-f).
- Creating a file and view the contents:
Creating a file can be done with the command cat , do almost the same as the command DOS (via copy con filename ), the way is $ cat> filename to save the file, press ^ D.
- View the content of the file, done with the command cat filename
- View the content of the file but only the first 10 rows only head filename
- View the content of the file but only 10 lines are tail filename
- View the content of the file but only the first 5 rows only head -5 filename
- View the content of the file but only row 5 only head -5 filename | tail -1
- Pause command:
On Linux there are two kinds of commands to view a list / file content per screen. Command is more andless The difference lies more with less on what is displayed in large numbers. More commands can only view a screen without being able to see what is displayed, so it can not scroll up to see a display that has passed.
Command less , more complete than more because less can view the past by using the up arrow.
4. Function Keyboard on Linux
- Ctrl + Alt + Fn = (n = 1 .. 6) Switch to the terminal to the-n. We can run multiple terminals at once, so it means we can log as many as six times simultaneously in the terminal / console
- Ctrl + Alt + F7 = Move to Xwindow which has been running
- Ctrl + Alt + Del = Restart the computer
- Ctrl + Alt + Backspace = Deadly Xwindow server (in Xwindow), this command is useful when Xwindow damaged so it can not exit normally.
- Ctrl + c = cancel the ongoing process
- Ctrl + d = Send a message EOF (End of File) to the ongoing process
- Up = Displays a list of commands that have been returned we typed.
- ~ = User directories
- | (Pipeline) = function is the same as in DOS, which is to run multiple commands simultaneously. But the command after the pipeline will use the input generated by the command before the pipeline. Example: ls | grep Desktop, that is the command grep will filter all the output generated by the ls command. So the output of the ls command to be input to the grep command.
Command Information System on Linux
- pwd = displays the currently active directory.
- hostname = Displays the name of the computer being used
- whoami = Displays the login name We
- WHO = Displays the currently active users
- id username = Displays the user ID and Group ID
- last = Displays a list of users who logged in last time
- ps = Displays the current process run by the user is currently active. If the parameter is added axu , then the process shown is a process run by each user.
- top = same as ps, but sorted by CPU usage
- free = Information memory, including RAM and Virtual Memory
- df-h = Displays the capacity of HDD (df = disk free)
- du-bh = Display details of HDD usage for each subdirectory (du = disk usage)
5. Creating User and Group
Linux operating system from the beginning it was designed to work with multiple users, means it is in Linux we can do login with different user names, and of course with different rights and permissions are different for files and directories.
Not only makes the user only, but all existing users can be grouped. For example, we can group users by department in the company, for example Group Marketing, Purchasing, Finance, Accounting, etc..
Now how do we create a user and group on Linux? The way is easy, and as I told at the beginning of the thread, we will do everything via command line or so-called text-based.
- Create a user, use the command # useradd Username
This will create a new user in accordance with our user name input. Note also that creating the user will make a directory in accordance with the user name in the directory / home. In addition, the default user group is the user name as well.
- View a list of existing users, the command # cat / etc / passwd
list of the user, will be shaped like this guest: x: 500:500: guest: / home / guest: / bin / bash
From the list, see if the list is divided into
seven columns / sections are separated by a: (colon).
- Column 1 contains the username
- Column 2 contains the password (only ditandi by a 'x', which means having a password)
- Column 3 contains the UID (user ID), UID is always started from 500
- Column 4 contains the GID (Group ID), the GUID is also always starts from 500
- Column 5 contains the user's Full name
- Column 6 contains the user's home directory
- Column 7 contains the user's shell
- Looking at the user's password in the form terekripsi, the command # cat / etc / shadow
- Deleting a user, use the command # userdel username
This command will remove users that we input, but does not remove the user directories in the folder / home.
- Delete the user and his home folder, use the command # userdel-r username
- Creating a Group, use the command # groupadd NamaGroup
This will create a new group. When the newly created group will be empty, meaning no members in this group. As explained above, that each production will start from the GID is 500. Now what if we want to give this GID to 700? Use the command # groupadd-g 700 NamaGroup .
- View a list of existing group, use the command # cat / etc / group
- Adding users to a specific group, the command # usermod-G NamaGroup Username
- Deleting Group, use the command # groupdel NamaGroup
6. User File and Directory Permissions in Linux
Since working with multiple users, then the file permissions and directory of each user is also a very vital.Often a particular user does not want the directory and the files do not want to be seen by others. And it could be directories or specific files that are allowed for others to see. Or it could be just groups of users that are allowed to see it but another group should not be seen. That is what the user permissions in Linux. We can determine the user or group who can view certain files or directories.
Let you perform the command ls-l , next to the far left will appear the user permissions of files and directories are displayed. The format is like this drwxrwxrwx which consists of 10 digits. Of that format, divided into four segments, namely: d rwx rwx rwx
- Segment 1 indicates the type, whether in the form of directories, regular files or link files. The code is:
- d = directory
- - = Regular file
- l = link file
- Segment 2 indicate the permissions for the owner (owner)
- Segment 3 indicates the permissions for the group
- Segment 4 marks other than the owner and group permissions (others)
For segment 2, 3 and 4 always rwx format, meaning:
- r = read, access to reading a file
- w = write, access to do the writing, editing (rename, edit), deletion of files or directories.
- x = execute, access to run a file or into a directory.
So if the format of permissions is like this:
- drwxrwxr-this means that:
- The directory is (because starting with the letters d, which means the directory) can be read, edited by the owner, and owners can also go into that directory.
- The directory is readable, edited by his group, and his group can get into that directory.
- This directory can only be viewed by a user or another group, can not do the editing (rename and delete), and can not get into that directory.
- -Rw-r -
- The file (since starting the sign - which means a regular file) can be read, edited by the owner, but can not be executed / executed (like. Exe in windows), because there are no permissions to execute (x)
- The file is only readable by his group, without being able to edited / deleted and can not be executed
- This file can not be read, edited / deleted and run by the user and group to another.
7. Giving Permission To Files and Directories
We already know what the existing permissions on files and directories in Linux. But we do not know how to give permissions to the file or directory. In Linux, to give permissions can be done with the command chmodpermissions FileAtauDirektori .
Option for the command chmod can be done in 2 ways, using letters and symbols using the symbol numbers.To use the symbol letters, the letters used consisted of:
- u = owner
- g = group
- o = others
- a = all
- + = Add permission
- - = Decrease permissions
- r = permission to read (read)
- w = permission to write (write)
- x = permission to execute or enter the directory (execute)
To give write access to the group, then the options that we have to give is g + w .
To remove read access to the user or any other group, then the options that we have to give is or .
In addition to the symbol letters, we can also use the symbol numbers. Symbol these numbers should be given at once for owner, group and others. So, if the symbol of the letter we can give permissions for owner, group or any others, then the symbol of this figure should be given all at once. Therefore, the symbol rate is always contains 3 digits, where the first digit will contain the owner permissions, group permissions for the second digit and third digit for permission others. Symbol numbers are:
- 4 = for read permissions (read)
- 2 = for write permission (write)
- 1 = for permission to run (execute)
So, if we want to give this permission to users
- DRW-r-xr- then the command when using the letter symbols are:
$ Chmod u + rw, ux, g + r, g-wx, o + r, o-wx file
when using the symbol rate, then the command:
Number 6 is read and write access, since read access is 4 and the write is 2, then the number is 6.Likewise for group permissions, permissions number 5 comes from reading a value of 4, and the permission to run valuable one. Since the user or another group may only be read only, then given a value of 4.
- Another example, suppose initially permissions are like this drwxrw - and we want to replace it to be like this DRW-rx- , then the command:
or
To change the owner of a file or directory, use the following command: chown PemilikBaru NamaFileAtauDirektori
To change the group of a file or directory, use the command beikut: chgrp GroupBaru NamaFileAtauDirektor
8. Example Use of User Permission
For more details, we will go straight into a case only.
- We will create a group with the name of IT and also make the user with the names: Benny, Budi, and Iwan . And remember do not forget to provide a password. The command:
- # Groupadd it
- # Useradd benny
- # Passwd benny
- # Useradd mind
- # Passwd mind
- # Useradd iwan
- # Passwd iwan
- Except Iwan, users are members of the IT group. The command:
- # Usermod-G it benny
- # Usermod-G it mind
- Next is to make the directory for the group where each member of the group it can read, write and execute the directory, but not for other users or groups. And any files or directories within it must have the same permissions to that directory, that can read, write and execute the directory.
The command: - # Mkdir / home / it
- # Chgrp it / home / it
- # Chmod g + rwxs, o-rwx / home / it (or write # chmod 2770 / home / it)
Watch it for no additional permissions hurus 's' and the symbol of a 4-digit numbers. The letter 's' (or the number 4 at the symbol rate) means special permissions. The effect of this is a special permission, if that directory already we set ungrouped into it , then any files or directories within it are made after permission is made, then his group will follow the main directory. If using a symbol rate, then the special permissions are placed on the first digit. Means the second digit is for owner permissions, group permissions for the third digit and fourth digit for permission others. If no special permission, then we can write the 3-digit format. For the symbol rate, the following is meant:
- 4 = u + s
- 2 = g + s
- 1 = sticky bit (that which can remove only the owner, for the letter symbol is marked with the letter 't').
- Now try to login with user benny, and try to create any file in the directory / home / it.
- Then try to login with the user's mind, edit the file. It turned out that mind can edit the user files is.This is because the group the file is it, where the group permissions are read, write and execute.
- Now try to login with user iwan, and try to edit files created by user benny earlier. Apparently not.Iwan user can not even go into the directory / home / it at all. This happens, because the user iwan is not a member of the group it.
9. Using the VI Text Editor
There are many text editors available on Linux, from the CLI-based to GUI-based. Some text editors are
- vi
- emacs
- joe (for those who want to reminisce with WordStar / ws, joe is a lot like him)
- pico
- etc.
Vi text editor is composed of two kinds of modes, namely editing and command. When in editing mode, we can edit the file that we created, such as add, delete or edit the text.
When in command mode, meaning we can give commands to vi. The commands are referred to it as a command exit, save, copy, delete, etc.. This command can also be in visual form. When in the visual mode, we can do to block certain lines and make a copy of that line and so on.
To enter into editing mode, you can press the i . To switch modes, from editing mode to command mode, we can press the ESC key .
10. Installing Programs on Linux
Installation on Linux consists of two kinds, namely the installation of the repository and the installation of additional programs (non-repository). Installation of the repository means we will install additional programs already provided by Linux distributions, such as from a CD / DVD or from a server (and mirrors) distro itself.
Installing additional programs (non-repository), it means we will install other programs that are not found in Linux distributions or can we also will install the programs that are in the distro, but a different version.
- Installation of the Repository
for the installation of the repository, depending on the distro we use, because each distro has commanded respectively. Here are some commands that exist in several distributions: - Mandriva = urpmi
- Red Hat & Fedor = yum
- OpenSUSE & SUSE = YaST2
- Ubuntu, Kubuntu, Edubuntu, Xubuntu = apt-get
- PCLinuxOS = apt-get
Example:
- Installing a tree in Mandriva, urpmi tree
- Installing webmin on PCLinuxOS, apt-get install webmin
- Additional Installation Program (non repostori)
There are times when we did not find any application that we want in the Linux distribution that we use, or application that we want there, but we need a higher version. At times like that we need to install additional programs (non-repository) is. Additional program installation, this depends on the derivative distributions that we use. In general, distributions of Linux available today can be divided into 3 groups, namely:
- Red Hat derivatives (which have shaped the installer. Rpm)
- Debian derivative (having the shape of the installer. Deb)
- Slackware derivatives (which have shaped the installer. Tgz)
In this discussion, we will use the installer shaped. Rpm. The command to install package. Rpm is rpm-ivh packagename . The parameter i mean We will do the installation .
Parameters v means all progress will be displayed to the screen.
Parameter h mean progressnya display in a bar form, so it would seem the percentage.
To upgrade the package. Rpm, use the parameter U to replace the parameter i . To remove an application, use parametera e .
Explanations and further examples of the installation package. Rpm will be explained in the follow-up thread after thread. Continued later in the thread, will explain how to install package. Rpm is more complete, including the installation that requires dependencies, and installation via source code
source : binus hacker