Page 1 of 2 12 Last
  • Jump to page:
    #1
  1. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050

    Linux FAQ Thread


    1. How do i dual-boot windows and linux?
    2. Which Distribution/distro/'Linux' should I choose for a desktop machine?
    3. Which Distribution/distro/'Linux' should I choose for a server machine?
    4. How do I install package xxx on distro yyy?
    5. What program for Linux is like program zzz for Windows?
    6. What's the best software for xx?
    7. How do I gnome VFS for FTP/SFTP?
    8. Where does FreeBSD/OpenBSD/NetBSD fit in?
    9. How do I boot grub from a USB Stick?
    10. How do I tell what ports are open on my machine? How do I know what services are running?
    11. How to interpret netstat output
    12. What are all these ~ files?
    13. How do I make GTK apps (Firefox, Thunderbird, Gaim) look good in KDE?
    14. Which Filesystem do I choose?
    15. How do I mount linux partitions from windows?
    16. How do I recover a lost partition or corrupt partition table?
    17. How do I recover photos deleted on ext3 partitions?
    18. I've just updated my system and bash can't find a command, help!
    19. How on God's green earth do I use vi ?
    20. How do I use Emacs?
    21. Mount an NTFS volume at boot and grant access to normal users


    Other members, Please use sensible titles when you post something, use size tags to make it size 5 and post in a sensible order. Please also follow numbers. I will make every attempt to edit your question into this post so others can find it easily. If there's any technical information you wish to include, please include it in [ highlight=technical information ] tags.

    This thread is for posts that are to be included in the FAQ. To discuss anything in this thread, please post in the FAQ Thread Discussion thread.

    Comments on this post

    • dotancohen agrees : I'd like to see this thread expanded and stickied. Will add.
    • B-Con agrees
    Last edited by ishnid; June 21st, 2007 at 04:52 AM. Reason: Updated
  2. #2
  3. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    1. How do i dual-boot windows and linux?

    This guide assumes you're using a simple distribution like Ubuntu, Fedora Core, SuSE or Mandriva

    NOTE: SuSE has special instructions at the bottom of this post which are way easier, if you're not really technically inclined.

    First of all it IS going to require a reinstall.

    Know how big your HDD (Hard Disk Drive) is and how much RAM you have.

    The general rule is that you give twice as much swap as your RAM, but not more than 4GB.

    Let's assume you have an 80GB HDD and 512MB of RAM

    You will split it like so:
    [code]hda1 : 0.5GB - Linux boot partition
    hda2 : 39GB - Windows
    hda3 : 39.5GB - Linux main partition
    hda4 : 1GB - Linux Swap

    If you need more swap space because of your ram level, take it from windows' and linux' space.

    Now, insert your linux disc and create the partitions in those sizes. The linux boot partition should be ext2, windows should be ntfs, linux main i would recommend ext3, linux swap should be swap. Make sure you write the changes.

    Now, take the linux disc out and insert your windows disc. Install windows to the partition you gave it. Now put your linux disc back in and install linux.

    Mount the boot partition on `/boot`, The main linux partition on `/`, you've already formatted them so don't worry about that.

    When you install grub, make sure you check that you want to be able to boot windows too.

    It's imperative you do things in this order, or XP will mess things up for you.

    Technical Information Code:
    Doing things in reverse will
    cause Windows' loader, NTLDR, to occupy the MBR instead of
    GRUB/LILO. It will also result in the linux partition being marked
    inactive, which is a pain to resolve


    NOTE: CentOS doesn't support creating the NTFS partition. Fpr CentOS, do the following:
    1. Create the boot partition
    2. Insert the windows disk and create the windows partition and install
    3. Reinsert the CentOS disk and create the remaining partitions and then install CentOS.

    For SuSE (at least versions > 10.0), the installer automatically takes care of resizing the windows partition by default, if it detects a windows partition on the disk. You don't need to worry about reinstalling anything as the installer does everything correctly (at least on all the computers that your humble Forum Admin has done). Simply follow the proposed partitioning scheme that the installer suggests and it will automatically adjust everything to work right.
    Last edited by Scorpions4ever; September 11th, 2006 at 03:46 PM.
  4. #3
  5. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    2. Which Distribution/distro/'Linux' should I choose for a desktop machine?

    What do you want out of it? Is there any specific software you need?

    If you are a beginner looking for a desktop machine, go for Fedora Core or Ubuntu or
    SuSE or Foresight Linux. Which one you choose depends on personal taste. SuSE, Foresight Linux and Fedora Core are generally 'nicer' to use while ubuntu feels more like a real linux system. Fedora, Ubuntu and SuSE Linux also have the larger userbases, so any specific hardware questions (such as laptop installations, adjusting monitor resolutions, drivers for wireless cards etc.) are usually covered by their forums, where someone has already posted working solutions for any problems.

    If you're more advanced and looking for a desktop machine, go for the Debian Network Install CD. It requires a little more work to get it going, eg apt-get install gnome to install a user interface.

    If you're looking to take your linux experience to the next level and want to try out more bleeding-edge software, I recommend Gentoo. It's a hard job getting it going but you will learn a lot about linux in the process.

    Technical Information Code:
    If you need a specific package management system, be aware that
    Suse and fedora core use RPM, Ubuntu and Debian use DEB and
    Gentoo use Ebuilds with portage.

    Comments on this post

    • dotancohen agrees : For beginners: Ubuntu or Fedora. Best choices by far.
    Last edited by Scorpions4ever; September 11th, 2006 at 03:32 PM.
  6. #4
  7. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    3. Which Distribution/distro/'Linux' should I choose for a server machine?

    Do you have any specific software needs? Will you be using something like CPanel or Plesk?

    If you need CPanel or plesk, you should go with Debian (I recommend the network install), CentOS, Fedora Core or SuSE (Plesk is officially certified/supported for SuSE Enterprise)

    If you want a lot of administration tools and performance is slightly less important, go for CentOS, or if you want more bleeding edge software, Fedora Core or SuSE.

    If you want better performance and you know what you're confident at administrating a server, choose Debian or even Slackware.

    If performance is extremely important and you can cope without administration tools, choose Gentoo. Beware that in large quantities it can become difficult to administer, however. It also lacks an easy installer. Slackware also has no graphical installer, but offers a number of tweaking options.
    Last edited by Scorpions4ever; September 11th, 2006 at 03:37 PM.
  8. #5
  9. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1485
    4. How do I install package xxx on distro yyy?
    Your best bet is to use your distro's package management tools. On Fedora, that's Yum. On Debian/Ubuntu it's apt-get. On older versions of RedHat, it is rpm. On SuSE, it is called YaST Other distros have other package management tools.

    Usually, the command in yum looks like this:
    Code:
    $ su -
    # yum install programName
    In apt-get it's the same command:
    Code:
    $ su -
    # apt-get install programName
    For YaST, all you need to do is bring up the Software Management Tool (YaST --> Software --> Software Management). You can then browse through various categories (e.g. Graphics, Development, Games etc.) for software packages and simply point and click. You can also search for packages by name and then click on the ones that you want to install.

    For Gentoo, things are a lot more tricky
    ---
    To install a custom ebuild on gentoo, you need to create an overlay.
    Ours will be at /usr/local/portage

    [hl=bash]mkdir /usr/local/portage
    echo 'PORTDIR_OVERLAY="/usr/local/portage"' >> /etc/make.conf[/hl]

    Then decide where your ebuild will go, a category and name. Lets imagine
    we're using scribes' ebuild.

    [hl=bash]cd /usr/local/portage
    mkdir -p app-editors/scribes
    cd app-editors/scribes
    #copy our ebuild in
    cp ~/scribes-3.0.ebuild .
    mkdir files
    ebuild scribes-3.0.ebuild digest[/hl]

    Now if you're not using ACCEPT_KEYWORDS to use testing software, you
    need to

    [hl=bash]#This may fail if you've got this as a file or the directory
    exists. If you have this as a file, just echo this onto the file, if the
    directory exists, carry on
    mkdir -p /etc/portage/package.unmask
    echo "app-editors/scribes ~arch" >
    /etc/portage/package.unmask/scribes[/hl]

    But ~arch is not valid, you must replace it with your own, eg. ~x86.

    And sometimes the ebuild author wasn't kind enough to set the keywords
    in the ebuild, this means you have to

    [hl=bash]#Same goes as before
    mkdir -p /etc/portage/package.keywords
    echo "app-editors/scribes ~arch" >> /etc/portage/package.keywords[/hl]

    ---

    To install from source, use these commands for bz2 files:
    Code:
    $ tar -xvjf downloadedFile.bz2
    $ cd downloadedFile-folder
    $ ./configure
    $ make
    $ su
    # make install
    # logout
    And use these commands for gz files:
    Code:
    $ tar -xvzf downloadedFile.tar.gz
    $ cd downloadedFile-folder
    $ ./configure
    $ make
    $ su
    # make install
    # logout
    $ designates regular user
    # designates root user

    Avoid installing from source if you can. If you must, make sure that you know what you're doing, and doing it in a way that is compatable with your current system and installed programs.

    Comments on this post

    • LinuxPenguin agrees : Good post. Please include names of distributions, however, and there's an extra 'v' in your tar command. Please also provide a .gz example
    Last edited by Scorpions4ever; September 11th, 2006 at 03:40 PM.
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?
  10. #6
  11. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1485
    5. What program for Linux is like program zzz for Windows?

    I'm maintaining a list here:
    Windows Equivalent Software Guide for Linux

    If you have anything to add, then please PM me and I'll add it. If you are looking for software that is not on that list, then PM me and I'll find something, and add it to the list.

    Comments on this post

    • LinuxPenguin agrees : Would be nice to have a list of gnome equivalent too. Gaim, Nautilus, epiphany, rhythmbox, Inkscape, etc.
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?
  12. #7
  13. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    6. What's the best software for xx?

    Please stop asking this question, it's clearly opinion based.

    Since it will stop a lot of questions, however, i'll provide a brief answer on my personal views

    Audio
    amaroK (KDE/Qt)
    Rhythmbox (Gtk/Gnome)
    Audacious (Gtk/Gnome

    I happen to like amarok the best, but rhythmbox with audacious pinned on top isn't a bad combo.

    Video
    Mplayer (with no gui)
    Videolan/VLC (Gtk/Gnome)
    Totem (Gtk/Gnome)
    Kaffeine (Qt/KDE)

    Mplayer is just the nicest. Be sure to tip it the -fs -zoom switches and set it to default open .avi and .mpg in nautilus.

    If I see any more of this type of question, I'll expand this post.
  14. #8
  15. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    7. How do I gnome VFS for FTP/SFTP?

    With gnome
    Make sure you have gnome-vfs in your gnome installation (not applicable to most distributions).

    On your panel, right click, add to panel, and select `connect to server` and drag it onto some spare panel. Click that and type in some details of a server you want to connect to. It will appear on your desktop. Doubleclick on it and type your password and opt to save it in your keyring for the future, it's less hassle only remembering one password.

    Without gnome
    Make sure you have vfs installed.
    Install gnomevfs-mount. It's tricky to get hold of, but it's in the portage tree if you use gentoo. I can only otherwise seem to find a mandrake cooker RPM.

    I can supply the sources from the portage tree upon request.

    Before mounting gnomevfs, you need to start the backing daemon...

    $ gnomevfsd

    this mounts your server at /ftp/myserver.com . You can write to it from any other program now, just choose to save to somewhere in /ftp/myserver.com

    $ gnomevfs-mount ftp://usernameassword@ftp.myserver.com /ftp/myserver.com
  16. #9
  17. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    8. Where does FreeBSD/OpenBSD/NetBSD fit in?

    BSD is not linux. It is a UNIX-like (we generally call it a UNIX, but it's not allowed to bear the brand name) operating system (much like linux was designed to be) that is much more tightly designed and can often perform much better than linux in server environments. This forum is for Linux, so if you want BSD advice, please look in the BSD Forum
  18. #10
  19. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    9. How do I boot grub from a USB Stick

    This has enough information to get you going, but beware, it's not the simplest thing.
  20. #11
  21. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    The grassy knoll
    Posts
    115
    Rep Power
    47
    10. How do I tell what ports are open?
    Or: what services are running on my Linux box?

    The netstat command will show all open ports and the services running on each displayed port. Netstat also displays open unix sockets.

    N.B. Your output will vary depending on services running, e.g. FTP, HTTP, SMTP, etc.

    'netstat -a' shows open ports by service name:
    (output edited to fit forum formatting.)

    Code:
    Active Internet connections (servers and established)
    Proto  Local Address   Foreign Address      State
    tcp     *:submission       *:*             LISTEN
    tcp     *:http             *:*             LISTEN
    tcp     *:auth             *:*             LISTEN
    tcp     *:ssh              *:*             LISTEN
    tcp     *:smtp             *:*             LISTEN
    Local Address is the pertinent field.

    'netstat -a -n' displays as port numbers:
    Code:
    tcp 0.0.0.0:80 *:* LISTEN
    You can get a simple list of open ports and service names with the nmap port scanner:
    Code:
    $ nmap localhost
    
    Starting nmap 3.93 ( http://www.insecure.org/nmap/ ) at 2006-06-22 11:33 CDT
    Interesting ports on localhost (127.0.0.1):
    (The 1663 ports scanned but not shown below are in state: closed)
    PORT    STATE SERVICE
    22/tcp  open  ssh
    25/tcp  open  smtp
    80/tcp  open  http
    113/tcp open  auth
    587/tcp open  submission
    
    Nmap finished: 1 IP address (1 host up) scanned in 13.428 seconds
    Resources:
    Netstat man page
    Nmap
  22. #12
  23. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,905
    Rep Power
    3969

    11. How to interpret netstat output


    11. How to interpret netstat output

    Expanding a little on the last FAQ:

    A quick bit on the output of netstat (for linux, but similar in windows), it's actually pretty simple. I like to use the command netstat -na | grep tcp to disable the conversion of ip's and ports to their host/service names and to filter the output to only tcp, removing all the unix domain sockets crud that most people don't care about.

    Here's the output of my system right now. The grep causes the headers to be cut out, but I put them back in for clarity. You could also grep -v unix to keep the headers and still remove the unix stuff:
    Code:
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 0.0.0.0:139             0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:48432         0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
    tcp        0      0 127.0.0.1:56348         0.0.0.0:*               LISTEN
    tcp        0      0 0.0.0.0:445             0.0.0.0:*               LISTEN
    tcp        0      0 192.168.0.2:43128       64.12.29.72:5190        ESTABLISHED
    tcp        0      0 192.168.0.2:53826       207.46.0.60:1863        ESTABLISHED
    tcp        0      0 192.168.0.2:59279       205.188.5.215:5190      ESTABLISHED
    tcp        1      0 192.168.0.2:46540       66.249.81.100:443       CLOSE_WAIT
    tcp        0      0 192.168.0.2:34790       216.155.193.186:5050    ESTABLISHED
    tcp        0      0 127.0.0.1:56348         127.0.0.1:60252         ESTABLISHED
    tcp        0      0 192.168.0.2:45004       205.188.248.131:5190    ESTABLISHED
    tcp        0      0 192.168.0.2:58764       216.239.37.125:5222     ESTABLISHED
    tcp        0      0 192.168.0.2:58135       64.215.169.192:80       ESTABLISHED
    tcp        0      0 192.168.0.2:58138       64.215.169.192:80       ESTABLISHED
    tcp        0      0 192.168.0.2:57016       205.188.8.78:5190       ESTABLISHED
    tcp        0      0 192.168.0.2:34812       193.45.14.151:80        ESTABLISHED
    tcp        0      0 192.168.0.2:34807       193.45.14.151:80        ESTABLISHED
    tcp        0      0 192.168.0.2:50796       64.12.165.83:5190       ESTABLISHED
    tcp        0      0 192.168.0.2:39151       64.86.136.104:80        ESTABLISHED
    tcp        0      0 127.0.0.1:60252         127.0.0.1:56348         ESTABLISHED
    tcp6       0      0 :::22                   :::*                    LISTEN
    Quick explination of the columns:
    • Proto - The protcol that the socket is using.
    • Recv-Q - How much data is waiting on the incomming buffer, waiting for the application using the socket to call recv() to read it.
    • Send-Q - How much data is waiting on the outgoing buffer. Stuff the application sent with write(), but hasn't been sent across the wire yet.
    • Local Address - The local IP and Port the socket if bound to. For sockets in state LISTEN, this is the port number it's running on, and what IP's you can connect from (0.0.0.0 or * means any IP)
    • Foreign Address - The remote IP and Port of the socket. For sockets in state LISTEN this is basically N/A (listed as 0.0.0.0:* above) because there is no remote side. for other states, this is the IP/Port of the remote host you have connected to (or that has connected to you).
    • State - The state of the socket. Three basic states:
      LISTEN - A socket accpeting connects. A service of some kind, such as ssh, mysql, apache, etc.
      ESTABLISHED - A socket being activly used. Connected to two points, ready to read/write data when necessary.
      TIME_WAIT - A socket where one side has closed the connection, and is waiting on the other site to acknowledge the closure and close their end.


    So, take a few lines for example:
    Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 0.0.0.0:5900            0.0.0.0:*               LISTEN
    That is a TCP socket. It is listening on port 5900 (VNC) on any address. So, this means I have a VNC server accpeting connections on any address on port 5900.

    Code:
    Proto Recv-Q Send-Q Local Address           Foreign Address         State
    tcp        0      0 192.168.0.2:34812       193.45.14.151:80        ESTABLISHED
    This is also a TCP socket. There is no data waiting to be either read or written. The local socket is running on IP 192.168.0.2, port 34812. The port doesn't matter much. This is a socket made (likely by firefox) to connect to a website. Connecting sockets generally take a port at random from whats available. The site I'm connecting to is 193.45.14.151 (which I have no idea what the hostname is, reverse-dns doesn't resolve it), on port 80 (which is http). The socket is connected and active.

    Hopefully that helps a little.

    Comments on this post

    • codergeek42 agrees : Sexy netstat output! :)
    Recycle your old CD's, don't just trash them



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud
  24. #13
  25. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    The grassy knoll
    Posts
    115
    Rep Power
    47
    12. What are all these ~ files?
    Some text editors (notably emacs and vi/vim) create backup files when you are editing text. These files are traditionally marked with the tilde (~), e.g. afile~. With a default configuration these files are usually left in the directory where the source file is located (provided you have write permission for that directory). This can be annoying.

    Emacs and vim can be configured to either disable or place the backups in a particular directory.

    Sample configurations:
    N.B. These are for latest versions. Please see your editor documentation for specifics.

    Emacs -- Add to your .emacs
    Store backups in one directory:
    Code:
        (setq backup-directory-alist ("." . DIR))
    DIR is wherever you want, e.g. $HOME/backup

    Disable backups:
    Code:
    (setq make-backup-files nil)
    Vim -- add to .vimrc
    Vim by default does not save the backup file.
    Code:
      set backup 
      set backupdir $HOME/dir
    Consult your editor's documentation for its option if available.

    If you know of specific options for other editors such as jed, gedit, etc., please PM and I'll add to this list.

    Comments on this post

    • LinuxPenguin agrees : Great post, but please number (number is 12)
  26. #14
  27. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1485
    13. How do I make GTK apps (Firefox, Thunderbird, Gaim) look good in KDE?

    The GTK-Qt Theme Engine is all you need!

    Comments on this post

    • LinuxPenguin agrees : For gentoo : http://tinyurl.com/pty2o . Knew I recognised it when you posted that
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?
  28. #15
  29. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1050
    14. Which Filesystem do I choose?
    What do you want from it? Do you need to be able to read it from windows? Then get ext3 and install Ext2fsd off sourceforge to read it.

    Ext4 is completely unstable and I'm fairly certain that it's only in gentoo sources to lighten the load on the support forums when newbies break their systems and get fed up.

    Do you need ultra recoverability? Go for JFS. It's pretty fast too. One thing to note is that you need to have it check the FS every time it's mounted to replay the journal just in case you have a powercut or something. That can be done by setting the last digit on the line of /etc/fstab to '1' (for your root partition) or '2' for non-root partitions.

    Do you need ultimate speed and maximum capacity from your harddrive? XFS. It's quite hard to recover data from though once you lose it. Not a bad combo to pair with a UPS (uninterruptible power supply) though.

    ReiserFS is supposed to perform well with lots of small files, but Reiser3 has lost me data 3 times in 2 weeks, and i don't fancy trying again. It's known to be buggy too. Reiser4 is stupid, I don't recommend either reiser's usage.

    Ext2 is generally only good for boot partitions.

    (v)FAT is unsuitable for linux root partitions as it doesn't support symlinks.
Page 1 of 2 12 Last
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo