INtroduction to linux

Discussion in 'Open Source' started by gary4gar, Oct 12, 2006.

Thread Status:
Not open for further replies.
  1. gary4gar

    gary4gar GaurishSharma.com

    Joined:
    May 21, 2005
    Messages:
    4,094
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    Jaipur
    What is Linux?

    Linux is an Open Source, free Operating System created by Linus Torvalds.


    What is the linux kernel?

    The Linux kernel is the core of the Linux operating system. To find out which version of the Linux kernel you are running, simply type uname -r in a terminal. For more information on the Linux kernel, please visit http://www.kernel.org


    What distribution of Linux should I install?

    One of the pleasures of running linux is choice. The choice of which Linux Distribution you wish to run is 100% up to you. You can browse our Distributions Page for comparisons of thevarious distributions out there. If you are totally new to linux we suggest you start off with either Fedora core Linux or Mandrake Linux or ubuntu linux as they are easier to install, configure and maintain.


    Who is the root user?

    The root user is the master user or systems adminstrator of the machine. The root user has full access to all files and directories, which is why you will only want to use the root account to perform system maintainance or to install applications.


    How do I reboot my machine?

    In order to reboot your machine, you must instruct the Linux kernel to stop all the processes (programs) it's currently running. Do not simply press the reboot button on the front of your computer case, as Linux must be properly shut down/restarted. To restart your machine, as root, run either of the following commands in a terminal:
    reboot
    Code:
     shutdown -r now
    On most systems you can also press (all at once) the control, alt and delete keys.


    How do I shut down my machine?

    In order to shut down your machine, you must instruct the Linux kernel to stop all the processes (programs) it's currently running. Do not simply press the power off button on the front of your computer case, as Linux must be properly shut down/restarted. To shut down your machine, as root, run either of the following commands in a terminal:
    halt
    Code:
     shutdown -h now 

    How do I add a user?

    While logged in as root, type
    Code:
    adduser username
    at the shell prompt, replacing username with the name you want to use to log in. You can create as many users as you wish, one for each member of your family, for example.


    How do I delete a user?

    While logged in as root, type
    Code:
    userdel username
    at the shell prompt, replacing username with the user name you wish to delete.


    How do I change my login password?

    To set the password for a specific user, type (while logged in as root)
    Code:
    passwd usernam
    e at the shell prompt, replacing username with the name of the person who's password you wish to change. By typing just passwd you'll be able to change the password of the user under who's name you're currently logged in as. Do not use passwords which are easy to guess, like your middle name or your pets name.



    How do I change directories?


    Code:
     cd - Used to change directories
    Usage: cd [directory]
    Example: cd /home/joey/html
    Example: cd ../ (to move back one directory)
    Example: cd (to return to your home directory)
    For more information, in a terminal, type man cd


    How do I copy files?

    Code:
     cp - Used to copy files/directories from one location to another
    Usage: cp file newlocation
    Example: cp /home/joey/index.html /var/www/index.html
    Example: cp /home/joey/* /var/www/ (this will copy everything in /home/joey to /var/www/)
    For more information, in a terminal, type man cp


    How do I move files?

    Code:
     mv - Used to move or rename files
    Usage: mv file location (to move)
    Usage: mv filename newfilename (to rename)
    Example: mv index.html /var/www/index.html (to move)
    Example: mv index.html index2.html (rename)
    For more information, in a terminal, type man mv


    How do I edit files?

    The default editor that ships with almost every distribution of Linux is Vi. This editor is slightly advanced and confuses most newbies. We suggest starting off with nano, a more simple editor. It might already be installed on your system. To edit a file with nano, simply run:
    Code:
     pico filename
    This will open up the file and allow to you edit it. At the bottom of the screen you will notice the various commands that you have access to with nano. If you wish to save the file and exit, simply hold down the control key and hit the x key on your keyboard.


    How do I list directory contents?

    Code:
     ls
    - To list the contents of a directory
    Usage: ls [flags] directory
    Example: ls (To list the current directory)
    Example: ls /home/joey (To list the contents of /home/joey)
    Example: ls -a (To list hidden files)
    Example: ls -l (To list file/directory permissions and file sizes)
    Example: ls -al /home/joey (To list all files and permissions in /home/joey)
    For more information, in a terminal, type man ls


    How do I delete files?

    To delete a file you must first have write permission to it. For information about permissions, click here. Once you have write permission, in a terminal run:
    Code:
     rm filename
    There is no "Recycle Bin" in Linux so once you delete a file, it's gone for good.
    When removing files, you may use an astrix (*) as a wildcard flag to remove certain files, for example if I wanted to remove all files that began with the letter j, I would run rm j*
    If anyone tells you to run rm -rf / as root, DO NOT LISTEN TO THEM. Running this command will delete all the files/directories on your Linux system.


    How do I delete directories?

    If you have ownership to the directory and the directory is empty, you can simply type
    Code:
    rmdir directoryname
    to remove the directory. If the directory is not empty and you wish to simply delete it and all its contents, run
    Code:
    rm -rf directoryname
    Please be careful with the -rf flag, as it will remove everything in the specified directory including sub directories. With root access and the rm -rf command you can wipe out your entire system if you make an error.


    How do I access my cdrom drive?

    Linux requires you to mount your cdrom/floppy drives when you wish to use them. On most Linux distributions, the mount command will require root access. Depending on which Linux distribution you run, one of the following commands should mount your cdrom drive. As root, run:
    Code:
     mount /dev/cdrom /mnt/cdrom
    mount /dev/cdrom /cdrom

    How do I access my floppy drive?

    Linux requires you to mount your cdrom/floppy drives when you wish to use them. On most Linux distributions, the mount command will require root access. Depending on which Linux distribution you run, one of the following commands should mount your floppy drive. As root, run:
    Code:
     mount /dev/fd0 /mnt/floppy
    mount /dev/fd0 /floppy

    How do I view/change ownership on files/directories?

    One of the great features of Linux is that it is a multi-user system. With multi-users, it allows certain users to own files and directories so nobody else can access/modify them, for example your /home directory. To change the ownership of a file/directory, as root execute the following command in a terminal:
    Code:
     chown username. filename/directory
    This will change the ownership and group ownership of the specified file or directory to the specified user. For more information, in a terminal, type man chown


    How do I view/change permissions on files/directories?

    There are 3 different attributes a file can have that make up the permissions for the file.
    There is read access that allows users to read the file.
    There is write access that allows users to modify the file.
    There is executable access that allows users to execute the file.

    From these three attributes, you now have three different levels of permissions, the first being for the owner of the file, the second being for the group the file belongs to and the third being all other users on the system.

    To view the current permissions on files and directories run the following command:
    ls -l and you should see something that looks like:

    drwxrwxr-x 3 joey html 4096 Sep 12 2000 images/
    -rw-rw-r-- 1 joey html 267 Aug 8 12:55 index.shtml

    The above shows you that images is a directory (d) and that the owner and group (joey html) have read ?, write (w) and execute (x) permissions while other users on the system only have read ? and execute (x) permissions.
    For the index.shtml file, it shows joey and html as the owner and group and they both have read and write access to the file. It also shows that other users on the system only have read access. Note there is no executable permission since the file is not an executable.

    To modify the permissions on a file, you either have to own it or be logged in as root. To modify the permissions, in a terminal type:
    Code:
     chmod xxx filename/directory
    You will have to replace the xxx flags with the permissions you wish to change. You can either go by the numerical value or by the actuals.

    Some common numerical values are:
    755 - Read, Write, Execute for owner, read, execute for group and other.
    644 - Read, Write for owner, read for group and other.
    666 - Read, Write for all.
    700 - Read, Write, Execute for owner, nothing for group, other.

    So if you wanted to make a file an executable for your user and other users on the system, you would run the following:

    chmod 755 somefile

    For more information, in a terminal, type man chmod



    How do I find files on my system?

    There are two methods to search for files on your Linux machine, one method being the locate command and the other being the find command. If you wish to use the locate command, you must first update the locate database by running the following command in a terminal as root:
    Code:
     /usr/bin/updatedb
    This will create an index of all the files and their locations on your hard drive. Once updatedb has completed running, you may now search your drive for a specific file by running the following command in a terminal:
    Code:
     /usr/bin/locate filename
    Another way to search your linux system is with the find command. To find a file on your sytem with the find command, in a terminal run the follwoing:
    Code:
     /usr/bin/find / -name filename
    Be sure to replace "filename" with the actual name of the file.


    How do I unzip a .tar.gz/.tgz file?

    To extract .tar.gz or .tgz files, run the following command in a terminal:
    Code:
     tar -zxvf file.tar.gz
    (or file.tgz)
    This will normally create a new directory based on the filename. If you want to extract a filename called file.tar (without the .gz) simply run:
    Code:
     tar -xvf file.tar
    For more information, in a terminal, type man tar


    How do I unzip a .bz2 file?

    To extract .bz2 files, run the following command in a terminal:
    Code:
     bunzip2 -dv file.bz2
    This will normally create a new directory based on the filename. For more information, in a terminal, type man buznip2


    How do I install a program?

    There are many ways to install applications in Linux. If the file you wish to install is in .rpm format and you are running an RPM based distribution such as Red Hat, Mandrake or SuSE, run the following command as root in a shell prompt/terminal:
    Code:
     rpm -Uvh filename.rpm
    If you are running Debian GNU/Linux and you wish to install a .deb file, you can do so by running the following command in a terminal as root:
    Code:
     dpkg -i filename.deb
    or
    Code:
    apt-get install package
    (if you have APT already installed/configured).

    If the file you with to install is in a .tar.gz, .tgz or .bz2 format, you will first have to decompress (unzip) the file. Once the file has been unziped, it should create a directory based on the filename. Simply change into that directory and open up the README or INSTALL file in a text editor and follow the installation instructions.



    How do I run a program?

    To run a program, you must first make sure it has executable permissions set. For more information on permissions, see How do I view/change permissions on files/directories? above. Once the file has executable permissions, simply run the filename from a terminal. I will use the filename "irc" as an example
    Example:
    Code:
    /usr/bin/irc
    (from anywhere on the system)
    Example: ./irc (from the /usr/bin directory)



    source
     
    Last edited: Oct 12, 2006
  2. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,705
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    Good job @Gary. But the text needs to be formatted correctly to be read easily!!
    Also make the commands appear in Bold.
     
  3. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
  4. OP
    OP
    gary4gar

    gary4gar GaurishSharma.com

    Joined:
    May 21, 2005
    Messages:
    4,094
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    Jaipur
    i think u should merge that thread with this as this is a intro who it will come first

    btw where is Satissh these days?
     
  5. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,705
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    @Gary, now it's better. @Satissh is busy right now. He PMed me a couple of days back.
     
  6. GNUrag

    GNUrag FooBar Guy

    Joined:
    Jun 22, 2004
    Messages:
    1,246
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    Interwebs
    pssstt..
    may i ask what is the point behind copy and pasting articles verbatim from popular sites.
    and yes, it doesnt matter if credit is given or not..
     
  7. ~Phenom~

    ~Phenom~ The No.1 Stupid

    Joined:
    May 17, 2005
    Messages:
    1,703
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    CYBERYARD
    Just a query ,
    is there a difference between GNU , GNU/Linux and Linux????
    Is BSD not linux???
     
  8. GNUrag

    GNUrag FooBar Guy

    Joined:
    Jun 22, 2004
    Messages:
    1,246
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    Interwebs
    GNU, Linux and BSD are different projects. GNU aims to create a completely free operating system. Linux is a kernel which is most popularly used.

    BSD is another free kernel which was developed in Berkeley Univ. Most popular distributions available with with BSD flavour are FreeBSD, PC-BSD, OpenBSD, NetBSD...
     
  9. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
    BSD and Linux are different. IMO, BSD is more geekier, more stable and more slow in the pace of development. But, the thing that is enticing me to get a properly working FreeBSD system is ports. I have heard that BSD's port system is the best package management system. In fact portage used in Debian is based in ports system in FreeBSD.
    @Anurag you forgot DesktopBSD
    I have tried out PC-BSD and installing is a piece of cake.
     
  10. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
    ^^Hey guys(mods) dont mind, but please help us in getting PC-BSD or whateva BSD that is easy in installing! The last time digit gave us freeBSD around 1.5 yrs back I guess, it changed the face of whole partitions in mah system and everything was gone! Right now I'm installing that BSD on Virtual machine, after discussing soo much about BSD! Please think about mah request.
     
  11. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
    If you are asking for it to be bundled in the magazine, then I don't think we can help.
    Well PC-BSD is very easy to install have a look at this http://forum.techspot.in/showthread.php?t=2502. Of what I heard DesktopBSD should be easy to install to. I'd recommend you that, cos last time I saw latter had more apps.
    BTW, you can enable port system and get all FreeBSD apps on both of them.
     
  12. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
  13. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
    I can't really say much about FreeBSD and Solaris cos I have not been able to successfully install them. I will be mostly trying out FreeBSD again next month. If I can get it installed successfully, then I will post more on it.
     
  14. OP
    OP
    gary4gar

    gary4gar GaurishSharma.com

    Joined:
    May 21, 2005
    Messages:
    4,094
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    Jaipur
    i belive that knowledge spreads with sharing so i keep posting the anything that helped me. thats it!
    i don't any credit for it but just want that nobody should face problem searching for help in a vast help of google. As i did for many days to learn the basics & understanding what linux is.
    if u have any objection, i will stop right now no problems in that

    on the lighet side its only thorugh this post that i knew that Linus Torvalds created linux:D
     
  15. praka123

    praka123 left this forum longback

    Joined:
    Sep 7, 2005
    Messages:
    7,513
    Likes Received:
    24
    Trophy Points:
    0
    Location:
    -
    It's OK gary.it will help N00b's 4 sure.keep cool;)
     
  16. jz2linkinpark

    jz2linkinpark New Member

    Joined:
    Jul 24, 2006
    Messages:
    559
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Rorikstead
    i don't like the linux very much...it refused to sync properly with my comp. and i had to take it to a service centre where they charged me money to just get it fixed..why waste money fixing what linux does to the machine when you can save and finally buy the best OS(vista) on the planet?(this is just my opinion)
     
  17. mediator

    mediator New Member

    Joined:
    Mar 18, 2005
    Messages:
    2,491
    Likes Received:
    16
    Trophy Points:
    0
    Location:
    In ur Evil Mind!
  18. mehulved

    mehulved 18 Till I Die............

    Joined:
    Jul 15, 2004
    Messages:
    5,790
    Likes Received:
    44
    Trophy Points:
    0
    Location:
    India, Mumbai, Marine Lines
    Please protect your delicate computer. Or else linux bots will attack and install itself. You will never be able to remove it and your PC will become junk and along with it, your precious cell phones too.
     
  19. GNUrag

    GNUrag FooBar Guy

    Joined:
    Jun 22, 2004
    Messages:
    1,246
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    Interwebs
    see gary, try to understand. When you copy-paste entire articles, you might be voilating the copyrights of original publisher(it does not help if you post the link of original source either). Generally the copyright statement reads as No portion of this work may be published in electronic format, photocopy or digital information retrieval system.. blah.. blah

    i'm just telling you to be responsible towards other's work. if the original work is under CC-SA or GFDL then there is no problem.
     
  20. JGuru

    JGuru Well-Known Member

    Joined:
    Dec 25, 2005
    Messages:
    1,705
    Likes Received:
    32
    Trophy Points:
    48
    Location:
    Space-time continuum
    @Gary, GNUrag has a valid point. Instead of Copying & Pasting , you can give the link itself!! I think that's enough.
     
Thread Status:
Not open for further replies.

Share This Page