Ultimate Newbie Guide to the GNU/Linux Shell (presented by Icrontic)

LincLinc OwnerDetroit Icrontian
edited March 2010 in Science & Tech
Our Alternative OS guru drasnor has authored a guide for beginners looking to get their feet wet in the GNU/Linux shell.

Ultimate Newbie Guide to the GNU/Linux Shell

Great work, drasnor!

Comments

  • lemonlimelemonlime Canada Member
    edited March 2006
    Awesome work drasnor! I really need to get *nix installed on my second PC again and start using it regularly. Great info, I'm sure I'll be referring to it again soon.
  • edited March 2006
    Very nice article.

    Skryking
  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian
    edited March 2006
    Most modern distros have top installed, and i prefer to use top to ps for process listing.

    Excellent primer, drasnor! I wish I had this a few years back when I was starting to have to use unix :)
  • GrayFoxGrayFox /dev/urandom Member
    edited March 2006
    Great guide I will give this to noobs looking to play with the console.
  • TroganTrogan London, UK
    edited March 2006
    Excellent guide Drasnor :thumbsup:
  • airbornflghtairbornflght Houston, TX Icrontian
    edited March 2006
    if i didnt have to go to work id go through and read it, i see that it says noob guide, how deep does it go (hacking[not cracking], modifying, customizing?)
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2006
    another important concept (present in windows as well) is relative vs absolute paths. It just comes up in the console/shell a lot more than in windows.

    All filenames and directories can be specified using absolute or relative paths.
    Lets say that you have this simple file tree:
    / (the highest level directory)
    /mnt (a directory where removable storage is often mounted to, allowing you to access it)
    /mnt/cdrom (common path to the cdrom)
    /mnt/cdrom/adir (some directory on a cdrom)
    /home (a directory that usually holds all the users of a system's home directories)
    /home/shwaip (my home directory)
    /home/shwaip/docs (a documents directory)

    lets say you're in your home directory, and you want to copy something into your docs directory. As drasnor said, you can do this:
    cp archive.tgz docs/

    This is using relative paths; it is much easier in this case. However, say we want to copy from from the folder on the cdrom to my docs directory. To do this with relative paths, we'd need this (assuming we're in our home directory):
    cp ../../mnt/cdrom/adir/file.ext docs/

    That's extra typing, and that's only if we're two directories deep in our home folder. Using only absolute paths, that becomes:

    cp /mnt/cdrom/adir/file.ext /home/shwaip/docs/
    Note that the '/' character is first in absolute paths. This says "look in the highest level directory (/) for the "mnt" folder, rather than the current directory. Notice that I'm also using an absolute path for the docs folder. Once again, provided that we are in our home folder, this is excessive. You can mix absolute and relative paths to minimize typing as follows:
    cp /mnt/cdrom/adir/file.ext docs/
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited March 2006
    You have good points shwaip, I thought about including those distinctions but at the time I felt it would segue into a discussion of basic filesystem structure that I did not want to cover in this guide. The main purpose was to cover console commands and basics tasks and I didn't want to get bogged down discussing how systems are laid out in the level of detail they deserve in a newbie-oriented guide.

    -drasnor :fold:
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited March 2006
    yeah, it's impossible to come up with a guide that is both concise and complete...but this seemed like something that I always use whenever I'm doing stuff w/ the console.
  • EnverexEnverex Worcester, UK Icrontian
    edited March 2006
    Most modern distros have top installed, and i prefer to use top to ps for process listing.

    Excellent primer, drasnor! I wish I had this a few years back when I was starting to have to use unix :)

    You can't use TOP for most things though as it only lists things that are using the most CPU usage (or most of something else) where as you can use ps to check through other things, like ps -e | grep progname which is normally the main use for ps anyway.
  • EnverexEnverex Worcester, UK Icrontian
    edited March 2006
    Linux bash and NT/DOS shell aren't like each other even remotely. The only similarity being that they are both text prompts, heh.
  • edited March 2006
    an interesting command I like to use when moving around a directory structure is pushd and popd. you can issue the command:
    pushd .

    in a directory and then go about what ever you need to do in other directories...when you are done and need to go back just do:
    popd

    it takes you back to the directory you pushed earlier.

    Skryking
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited March 2006
    They're not that dissimilar at this level Enverex, mainly just syntax and command names (ls=>dir, cat=>type, rm=>del). I don't remember if piping works in the NT shell but I know redirects do. The challenging thing for most people is working with the command line interface. My personal experience is that it isn't hard to learn a new command line interface once you're proficient with one.

    -drasnor :fold:
  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian
    edited March 2006
    pipes work in the windows command shell in a very limited fashion. You can, for example, pipe dir to more

    dir | more

    Skryking: pushd and popd are so sweet. thank you for sharing that, that will make my life better :D
  • -tk-tk Detroit, MI USA Icrontian
    edited April 2008
    pipes work in the windows command shell in a very limited fashion. You can, for example, pipe dir to more

    dir | more

    Skryking: pushd and popd are so sweet. thank you for sharing that, that will make my life better :D


    yeah, I been known to "lay out some pipe" on the windows shell:


    dir /b > list.txt |for /f %i in (list.txt) do attrib %i or whatever | some other command

    Great for doing something on hundreds of files at once, etc.

    Also the && works too:
    dir && cls

    && = command one executes and then goes on to command two if successful.

    Comes in really handy when you have to write some jacked up .bat that changes enviornment varibles and whatnot.

    UNIX still wins for having a command called "mount" though...
  • KwitkoKwitko Sheriff of Banning (Retired) By the thing near the stuff Icrontian
    edited April 2008
    man mount
  • mmonninmmonnin Centreville, VA
    edited April 2008
    man mount

    For some reason that made me think of this picture. I had Picasa search My Documents the other day and I found this lovely gem again.
  • -tk-tk Detroit, MI USA Icrontian
    edited April 2008
    mmonnin wrote:
    For some reason that made me think of this picture. I had Picasa search My Documents the other day and I found this lovely gem again.

    ...leave it to you guys

    the funny thing is that if you issue that command, you get an ASCII representation of that exact picture.
  • edited May 2008
    I arrived at the thread as I was looking for such a guide but the link is probably too old and doesn't work anymore if anyone know of another newbie guide to the Gnu/Linux can you please link to it

    _______
    http://www.mylinuxgang.com/
  • drasnordrasnor Starship Operator Hawthorne, CA Icrontian
    edited May 2008
    http://icrontic.com/articles/ultimate_newbie_guide_gnulinux_shell

    The way articles are handled changed a little while back and not all of these threads have been updated.

    Welcome to Icrontic!

    -drasnor :fold:
  • edited May 2008
    Thanks!!
  • edited May 2008
    Thanks for sharing this nice link.
  • ComputerDoctorComputerDoctor Kankakee, IL
    edited April 2009
    Most modern distros have top installed, and i prefer to use top to ps for process listing.

    Excellent primer, drasnor! I wish I had this a few years back when I was starting to have to use unix :)

    Top is ok if you remember the commands associated when running it, but try htop (will need package install) it's more graphical and uses function keys for common commands.
  • edited March 2010
    I'd just like to thank You for the guide to the basics... Quality and indeed interesting article.
Sign In or Register to comment.