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

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    15. How do I mount linux partitions from windows?

    If it's not ext2/3, you don't. No, it won't read ext4 but that's VERY unstable anyway.

    If it is, download Ext2fsd.

    You'll need to have the daemon running in order to read and write to the partitions, so i recommend you tick to enable it at boot.

    Comments on this post

    • kicken agrees
    • peenie agrees : good call
  2. #17
  3. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    16. How do I recover a lost partition or corrupt partition table?

    Testdisk

    Works on every filing system under the sun, or thereabouts.
  4. #18
  5. המבין יבין
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jul 2001
    Location
    Haifa
    Posts
    2,085
    Rep Power
    1486
    17. How do I recover photos deleted on ext3 partitions?

    Use PhotoRec. I recommend version 6.5. Untar, and run as root:
    Code:
    tar -xjf testdisk-6.5-WIP.linuxstatic.tar.bz2
    cd testdisk-6.5-WIP/linux
    su
    ./photorec_static
    Now, if you are using Konsole, you will need to make the windows larger. Just drag the bottom-right corner of the Konsole window. The first step has the user select a hard disk to work on, and in the next step you choose the partition table type of that disk. Most likely, you will have an Intel partition. Here, you choose which partition you want to work on. The leading digit is the partition number, and very likely they will not be in numerical order. So, if you want to work on hda5, for example, then assuming that you chose hda in the first step, you would choose "5" now (or the extended partition under it). Once you have chosen which partition to work on, click "search". The program will tell you how many files it found, and how much time remaining until it finishes it's job. When it's done, back out of the menus with "quit", "quit", "quit" and exit the program. Now, cd to the partitions' mount point and verify that the photos are where they should be.

    TIP: If PhotoRec does not find all your pictures, try selecting the extended partition under the logical partition. This worked for me.

    WARNING: PhotoRec stores the files it finds in the directory where it lives- that means that you should unpack on a partition with lots of disk space. I managed to fill up my /home partition because of PhotoRec. And be certain to erase it's directory when you are done.

    Now, go make backups!

    Comments on this post

    • LinuxPenguin agrees : Use the beta :) great post
    Last edited by ishnid; February 14th, 2007 at 05:05 AM.
    . . . What is Firefox?
    . . . . . . What is Linux?
    . . . . . . . . . . . What is Love?
  6. #19
  7. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    18. I've just updated my system and bash can't find a command, help!

    Either the command was deleted (and you should know if it was), or it has been moved (as happened the other night on gentoo).

    Bash maintains an internal hash of commands in the path to speed up lookups, but if the command is moved while the bash session is open, that will mess things up because it looks in the wrong place.

    To rebuild the cache, I used `source /etc/profile` which loaded in the profile file and rebuilt the hash, but i have been told that `hash -r` will also work.
    Last edited by ishnid; February 14th, 2007 at 05:06 AM.
  8. #20
  9. blah
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Scotland
    Posts
    630
    Rep Power
    106
    19. How on God's green earth do I use vi ?

    Start vi:
    Code:
    $ vi ~/test
    You should get a blank screen full of '~'s on the left. And at the bottom:
    Code:
    ~
    ~
    ~
    ~
    "~/test" [New File]
    vi has different operating modes - command and input. It always starts on command mode, which is probably why, if you have tried to type something in, nothing is happening.

    To start off with type `i`. You can now start typing. Enter a few lines of text and press Esc to return to command mode.

    Now, to navigate around your lines:
    Arrow keys
    w - moves cursor to the beginning of the next word.
    b - moves cursor to the beginning of the previous word.
    0 - moves cursor to the beginning of the current line.
    $ - moves cursor to the end of the current line.
    H - moves cursor to the top-left hand of the screen.
    M - moves cursor to the first character of the middle line.
    L - moves cursor to the bottom-left hand of the screen.

    And to delete text:
    x - Deletes character under cursor.
    X - Deletes character before cursor.
    dw - Deletes from current character to end of current word.
    d$ - Deletes from current character to end of current line.
    d0 - Deletes from previous character to beginning of current line.

    Saving and quitting:
    ZZ - save changes and exit.
    :w - save but don't exit.
    :wq - same as ZZ.
    :q - quit the file; only works if you don't have unsaved changes.
    :q! - quit without saving.

    A few other necessary tips:
    Esc - command mode.
    u - undo.
    Ctrl+R - redo.
    :! command - run a command.

    Moving around a file:
    Ctrl+F- Page ahead, one at a time.
    Ctrl+B - Page back, one at a time.
    Ctrl+D - Page ahead, one-half at a time.
    Ctrl+U - Page back, one-half at a time.
    G - Go to last line of file.
    nG - go to the nth line of the file.

    Searching for Text (using / and ? ):
    /hello - searches forward for the word hello.
    ?goodbye - searches backward for the word goodbye.
    /The.*Files - searches forward for a line which has 'The' followed by anything followed by 'files'.
    ?[lL]ol - searches backward for either lol or Lol (Hopefully, neither of these will be found).

    vi was originally based on the ex editor. If you type a colon and the cursor goes down the bottom of the screen, you can enter a few ex commands:
    :g/Local - searches for 'Local' and prints every occurence.
    :s/Local/Remote - replaces Local with Remote on current line.
    :/Local/s//Remote - replaces the first occurence of 'Local' on every line with 'Remote'.
    :/Local/s//Remote/g - replaces every Local with Remote.

    Using Numbers with commands(You can add numbers to vi commands to save you time):
    3dw - deletes the next three words.
    5cl - changes the next 5 letters (removes them and enters insert mode).
    12j - move down 12 lines.

    I hope this helps those of you wishing to learn how to use vi.

    Peace!

    Source: Linux Bible 2006 Edition

    Comments on this post

    • LinuxPenguin agrees : 'a' also puts it to input mode. And I have an old copy of the 'redhat linux bible' which is a fantastic reference that i keep for bedtime reading for ghastly iptables and such
    • ishnid agrees : Nice post. Pity about the editor ;)
    • aitken325i agrees
    • dotancohen agrees : Number of the beast: VI VI VI
    Last edited by ishnid; February 14th, 2007 at 05:06 AM.
  10. #21
  11. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    20. How do I use Emacs?

    You can just start typing right away with emacs, unlike vi(m).

    Of course you'll want to do more than that. Emacs works on keyboard shortcuts, using the ctrl, meta (alt) and shift keys. I'll use the c-x/m-x/s-x notation from now on (ctrl-x/meta-x/shift-x) and of course typically you'll get things like c-m-x (ctrl-meta-x). Some things also require more than one shortcut to be pressed, like for example c-x c-s (save file). When i leave a space between shortcuts, they're to be pressed in order.

    Okay, so you've typed the coolest program/novel in the world, but you want to save it.

    Save : c-x c-s
    Since this hasn't been saved, emacs will prompt you for a filename, so type the path you want to save it to and hit enter. you can of course.

    That's your most important keyboard shortcut down. Now, how about copying and pasting?

    To copy/cut some text, you don't use the mouse. go to the part of the text you want to start copying from and hit c-sp (that's the spacebar). Then use the arrow keys to go to where you want the end of the cut/copy to be.

    Cut: c-w
    Copy: m-w

    To paste (`yank`), c-y.

    Magic. And on linux you'll notice it's been copied to your X clipboard (the middle click paste thing). On windows who cares, this is the linux FAQ.

    That's most of what you need to get around. However here are a few more tidbits

    undo: c-_ (underscore)
    c-x c-f find file (type a file path to open it)
    c-f : one character forward
    c-b: one character backward
    c-n: next line
    c-p: previous line
    m-b: Go to the beginning of the word (or at the beginning of a word, the previous one)
    m-f: Go to the end of the word (or at the end of the word, the next one)
    m-p: start of paragraph or previous paragraph
    m-n: end of paragraph or next paragraph

    The other thing to mention is that using the tab-key or spacebar when emacs prompts you for information will help you complete things like file paths (or in the case of m-x set-variable, the variable name). m-x is a special case in emacs since it prompts you for a command to run by name.

    There's a great tutor thing included in emacs which can help you much more than this guide can, if you're using the X version of emacs (NOT Xemacs!, just GNU Emacs), you can find this in one of the menus.

    HTH, and no it's not from a book.

    <edit>Thanks for the proxy reps guys</edit>

    Comments on this post

    • ishnid agrees : Nice reposte! Good info.
    • dotancohen agrees : Don't you need four hands to operate Emacs? A nice space-cadet keyboard?
    • fireatwill agrees
    • codergeek42 agrees
    Last edited by ishnid; February 14th, 2007 at 05:07 AM.
  12. #22
  13. blah
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Scotland
    Posts
    630
    Rep Power
    106
    21. Mount an NTFS volume at boot and grant access to normal users

    I realise this is very simple, but I do come across a lot of similar posts.

    OK, so you have a Windows (NTFS) partition that you would like to mount automatically every time your system boots. And you want to allow normal users to access this volume.
    This is very simple. Open /etc/fstab with your favourite text editor:
    Code:
    # nano /etc/fstab
    Lets say your windows partition is located at /dev/hdb1. Add this line to the end of the file:
    Code:
    /dev/hdb1       /mnt/windows    ntfs    auto,users,ro,umask=0222        0       0
    The first column states where your windows volume is located. The second is the mount point (where your volume gets mounted to) and no, it doesn't have to be /mnt/windows. The third is the filesystem - in this case, NTFS. The next column introduces various options you wish to use ( 'users' allows normal users to access the volume, 'umask' sets the appropriate permissions). The 5th and 6th columns are your Dump and fsck options which don't really matter in this case, just leave them equal to 0.

    Once you've added the line, save and exit. When you reboot you should be able to access the volume from a normal user's account.

    PS. `man fstab` will give you all the available options for the 4th column.

    Make sure the ntfs module is loaded before you mount or you'll get a 'filesystem type not recognised' error or similar. This shouldn't be a problem on the 'easy' distributions, but gentoo and slackware for example...

    To write ntfs you need ntfs-3g for which you need a whole load of extra packages.

    Gentoo
    ---
    [hl=bash]emerge ntfs-3g[/hl]

    Done, skip to fstab configuration below

    Ubuntu
    ---
    Guide on Ubuntu forums

    I'm not certain about it's recentness or whether it will have the now stable driver, but double checking that the version is at least 1.0 can't hurt.

    Fedora
    ---

    The fedora guys/gals have made it easy for you
    [hl=bash]yum install ntfs-3g[/hl]



    fstab configuration (all distros)
    ---

    Code:
    /dev/hdb1       /mnt/windows    ntfs-3g    auto,users,umask=000        0 0

    Comments on this post

    • LinuxPenguin agrees : Great guide
  14. #23
  15. blah
    Devshed Novice (500 - 999 posts)

    Join Date
    Nov 2003
    Location
    Scotland
    Posts
    630
    Rep Power
    106
    22. Adding to $PATH permanently

    Say you have a directory of scripts you would like to add to your PATH variable because you are sick of typing out the whole path to run a script.

    Add to your ~/.bashrc (or ~/.bash_profile) file:
    Code:
    $ echo 'export PATH="$PATH:/dir/to/scripts"'  >>  ~/.bashrc
    This will change the path for a single user. Add to /etc/profile to change globally (all users except for root).
  16. #24
  17. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    23. Reducing process priority / Reducing resources used by a program

    You can only really control the process priority on most systems and you're relying on that to starve your program in the hope that it won't be able to perform much I/O as a result.

    ./myprog &
    renice -n 10 %1

    This runs your program in the background and then increases its 'nice' by 10. %1 = " process priority of first background process in this bash session " Nice is from -20 to +20 and starts at zero. Only root can decrease nice.

    If you're using the CFQ I/O scheduler (and you really don't want to, it brings my systems to a halt when I do), you can use ionice to adjust io priorities, but unless you ionice every process on the system every time you start one, you aren't going to get any benefit out of it.
  18. #25
  19. fork while true;
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2005
    Location
    England, UK
    Posts
    5,538
    Rep Power
    1051
    24. How to setup a simple LAMP server system

    LAMP stands for Linux Apache MySQL PHP/Python/Perl

    For this I'm going to recommend the purpose-built rPath LAMP appliance. Stick in the install cd and follow the instructions.

    If you get stuck, there's great documentation
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo