Basic Linux commands
Results 1 to 2 of 2

Thread: Basic Linux commands

  1. #1
    Senior Member
    Join Date
    Nov 2002

    Basic Linux commands

    Well, i was going to put this as a tutorial, but its really not, i think its more a guide to getting yoursel around with the command line.
    And besides theres already a few Linux tutorials posted, this is more for a beginner who needs and extra look.

    Ok, lets start, if you have an account it helps

    Login in with your user ID and password (dont be lame and try guessing root's)

    now, if you start with X runing, pop up a terminal, if not, dont read this line

    Usually you will be working with the BASH shell or bourne again shell, a total of 6 consoles are usually available, you can switch between them using the Alt key + the F1-F6 keys, the 7th is reserved for X

    A command consists of several things, the first is always the command itself and then it can be followed by paremeters or options, after you type a command it helps to make sure you have no spelling errors, so check befre you press enter.

    A full list of options are available by typing ls --help.
    Also typing man and a command will give you the man or manual pages for that command.

    for directories, please read the following :

    /etc contains important files for system configuration.

    /etc/init.d contains boot scripts

    /usr/bin has the generally accessible programs on your box

    /usr/sbin contains programs for the system admin and things needed to boot, with a regular account you prolly dont have access to use these.

    /sbin/init.d contains boot scripts.

    /usr/include has the headers for the C compiler.

    /usr/include/g++ has the headers for the C++ compiler

    /usr/share/doc has a bunch of documentation.

    /usr/man is your friend, it has the system manual pages.

    /usr/src is the directory for the source code for the system software, Linux Hackers prolly like to look into this a bit more but if your a beginner you have to sart with the basics.

    /usr/src/linux contains the Linux Hackers best friend, the Linux source code.

    /tmp contains temporary files.

    /var/tmp contains the larger temp files.

    /usr contains the appliication programs that you will prolly be using more.

    /var has the configuration files, for example those linked from /usr.

    /var/log is the CRACKERS enemy, the system log files.

    /var/adm contains the system admin data.

    /lib contains the shared libraries for dynamically Linked programs.

    /proc is for process file system.

    /usr/local is for local, distribution independent extensions.

    /opt has optional non system software and some large packages like netscape, or GUIs like gnome and KDE.

    usually you can repeat a command youv entered recently by pressing the up arrow key.

    now, in DOS dir is a command to list things in your directory, in Linux use

    ls -l

    it will list everything in your directory your currently in. To see the contents of another directory without typing cd <directoryname> you can type ls and the directorys name, it will list all things in that directory, now, lets say you want to move a text document called text to a new directory, you would type mv text newdirectory. but what if you wanted to keep text in the current directory and want it also in newdirectory? well, type cp text newdirectory and you now have a copy, to verify this works type ls -l and make sure text is still in that directory,
    now type
    cd newdirectory

    ls -l

    and you should see text located in that one to.
    what? you want to delete that document text? type in

    rm text

    and its gone, now what if your on a network and need to e-mail another employee and cant get in your yahoo account to mail him because you dont know his e-mail address, well, UNIX systems were pretty much the first to have e-mail, lets say you need to mail bob slydell and tell him something, well if your work place has every account your first name and the letter of your last name, youd type

    mail -s "bob i need to tell you something" <press enter key>
    bob this is important blah blah.
    then press ^D
    The ^ in UNIX is the Ctrl key on your keyboard, so youll press down and hold down the Ctrl key and hit the D key
    i know for me that was hard to learn at first but its what it is. it may ask for another address youd like the message to be delivered to, if not, your done, other wise, either press enter ad your done or add another address you want to recieve the mail and then your done.

    Lets say your network connection seemed to be having troubles, well, find your IP address and type

    ping and your IP addess

    youll see it ping the host and give you a responce time, if the responce times are longer, you may need to contact your system admin or BOFH hehe.

    well lets say your waiting for a reply from bob slydel. How do you know when he replies? well at the prompt type


    if you have any mail it will tell you, other wise it will state you have no mail

    if you can, type


    into the commancd prompt, iv learned that this is a very easy to use mail service that works wlike the mail command except you can use arrow keys and it has a text based interface but allows you to select things and hit <enter>

    it also allows and address book and usually you use the < key and > key to navigate between messages, you may want to ask your system admin before starting pine, it creates folders and if your system admin is against it you may have to stick with the mail command, also to quit pine, use the arrow key and highlight the quit or exit line and press enter, it will ask if you really want to quit pine and if you do say yes, if you hit it by accident say "no". Now after you say yes to quitting pine, all e-mails you deleted or marked and any tasks you wanted done are completed, for example if you deleted mail, it asks if you would like the mail you deleted expunged.

    Now, file permissions, im not going to go into detail about this because it honestly bored me, but if you see something like

    that means you can prolly Read WRite and eXecute it.
    something like --r---- would mean only Read access, you can set whois allowed to see your files by typing chmod.

    to find things in your system type

    find somethingicantfind and itl will look for whatever you cant find and if its available show you, otherwise it will tell you it wasnt found.

    the cat command will display output, try it out

    cat filename

    or if you want numbers on the left margin type

    cat -n file

    now, lets say you need access to another device, that is used for mounting.

    mount <options> <device> mountpoint. that can be for cd roms, floppies, Zip get the idea.

    when you dont need to use the mounted device anymore, remember to umount it (unmount) otherwise you could lose data.

    umount<options> mountpoint.
    (you need to be logged in as ROOT to do mounting)

    wondering whats taking up soace on your system? type
    du and press enter

    youll be shown how much your things are taking up.

    the free command displays the sum of the total and working memory being used and the swap space.

    the top command displays A **** LOAD of info, how long the system has been up, whats running, things like that.

    want to change your password? type in passwd and you can change it, if your logged in as root you can change anyones.

    are you runing your system at home and need to do something as root and dont feel like logging out? type
    and it will ask for the root password, type it an and bang your the man.

    need to reboot? (hell your on Linux your just installing hardware right? hehe)
    reboot or on some Linux systems
    shutdown -r now

    if your logged in as root, it reboots, if not, it asks for the root password and then pops up a message saying the system is rebooting.

    notice your screen getting cluttered from all this? well type
    and the screen looks like it did when you first started, nice and clean, hehe.

    want to see who else is logged in? type

    and its displayed, or type w and press enter for a closely related look.

    for a more detailed explenation than that go to and search Linux, theres really billions of Linux sites that will give you a better explenation.

    I hope you enjoyed this, it sure took a long ass time to type so lets not be to harsh if i forgot something hmm?

  2. #2
    Senior Member
    Join Date
    Jul 2002
    Nice post. Anyway i downloaded these unix, vi and awk cheatsheets a while back from Hope this helps those who need it.

    Peace always,
    Always listen to experts. They\'ll tell you what can\'t be done and why. Then go and do it. -- Robert Heinlein
    I\'m basically a very lazy person who likes to get credit for things other people actually do. -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts