Page 1 of 4 123 ... LastLast
Results 1 to 10 of 34

Thread: Basic Linux Usage and Commands

  1. #1
    linuxbeast
    Guest

    Default Basic Linux Usage and Commands

    I agree with the mods. For all those that can't handle back|track, come back after you've used Linux for a while. Here are some of the most command commands and mistakes and what you can do to help yourself. GOOGLE is #1, but there other resources too. There's also a www.google.com/linux.

    You have a Linux problem, and you do not know what to do. First thing to do is check the logs. Most logs are located somewhere in /var/log, so go through and check it out even if you don't have a problem yet. To more things to remember are these "dmesg" as root, and cat /var/log/message" right after the the problem occurred. If it did not just occure, then repeat the procedure to make it occur again. What if you boot Linux and come to a black screen? This is not a BSOD Linux Style Black Screen of Death. No, Linux is running and the kernel isn't panicking. That's an issue with starting the graphical user interface. This is one place commands come in handy in restoring your desktop to the way it should be, but you have no command prompt when this happens. Hit control-alt-f1 or any of the function keys by default are F1-F6 and F7 being where the X graphical server runs that you always see.

    If you get an error message, Great! Now take that error message, put it in quotes for example "Permission denied" (usually much more complicated than this) and Google. Also look into advanced Google searches that you can enter into the Google search box if you have time.

    Are you having problems with 64 bit Linux? Then you shouldn't be using it. Get 32 bit (Yes, it will run on 64 bit procs and not noticeably slower, and chances are you are not using greater than or equal to 4 gb of ram. This is Linux, not Vista) Then when you've problem solved enough Linux problems, you are ready to take it up a notch.

    Now with your error, go to the official forum of your distro, try searching both the error and the problem. Don't post first thing. A lot of people have already had the same problem as you and even millions of duplicate bugs get posted on Bugzilla. I find that it's much easier and quicker to search in order to solve the problem, and if you are impatient like me, that's a plus.

    Use intuition to solve your problem. Understanding how Linux works is the key. If you just take commands you get and enter them in, you are making no progress. If you get commands to enter them in, then type in terminal "man command" replacing command with the first word of the command minus stuff like -v. -v is a command option to commands called verbose. When you are going through man pages, type /searchterm and hit enter. Then hit n for next to take yourself to the next search term. If you aren't at the top and want to search backwards, type ?searchterm. You most likely will be using a program called less to view the man page, but does not allow you to modify it.

    After you've tried all avenues with no success, then you ask for help. To ask for help, you must be specific, provide lots of information including exactly what you've done to try to solve the problem, errors, logs, etc, distro, arch, and more. Even Ubuntuforums.org is for several derivatives of Ubuntu and architectures.

    Commands

    # means this command should be run as root with a prompt ending with #

    $ means this command should be run as a normal user with a prompt ending in $ such as

    user@distro~/$

    I must point out a difference between micromoney windoze and Linux. There is no letter drives in Linux. Don't look for your C: drive in Linux. Good luck finding it because it is not there. Similarly though Linux has highest level directory called the root directory (not root user) that is at /, so anything such as /home /var/ etc is contained in the root directory like an upside down tree structure.

    First you must realize that when using the command, you are in a specific directory, and you can't access all files on the system from that directory without giving the full path. Here's a good explaination. When you are browsing with Explorer in Winblows, you might currently be in "My Music", "My Documents", "Program Files". If your mp3 that you would like to play exists in "My Music", can you open it from Program Files? Windows is limited, and Linux is almost the same, but you can execute a file from another directory if you provide the full path to that file. How do you know which is your current working directory? Remember each of these commands has a paragraph summary at the top of their man pages explaining briefly what the command is about.

    This does it. It tells you your current working directory. A lot of these commands are acronyms. They will help you remember them. PWD = Print Working Directory.
    Code:
    $ pwd
    Changing to a different directory. CD = Change Directory.
    Code:
    $ cd
    If you enter cd by itself, it will take you to the user's home directory that you are currently logged in as whether root, normal user, or hacked user on another machine with ssh, etc., so normally cd is used something like this.
    Code:
    $ cd /etc
    Now the file you want to view is in the directory called fstab. You can concatenate it which means print it to the screen, not your printer, so you type:
    Code:
    $ cat fstab
    What if you want to see that file from any directory? Then you provide the full path to it. From any directory, you can do this to get the same results.
    Code:
    $ cat /etc/fstab
    I would like to expand this but had exceeded the max limit of chars.

    If you get permission denied, this means you are not an "admin" user. The root user is that. If you are using Ubuntu or a distro with sudo configured using visudo, then you issue the command with sudo for example:

    CAT = conCATenate. You may not see how this is now, but try this. cat file1 file2. Now you have concatenated file1 and file2 together so file2 is appended to file1, but all that is printed to the screen. Later you can learn about bash redirection and pipes and different types of Streams. One use of that is to send the output from a command to a new file or existing file either overwriting it or appending it.
    $ cat /var/log/messages
    Should result in a permission denied

    Ubuntu and distros with sudo configured:
    $ sudo cat /var/log/messages

    All other Linux distros:
    Code:
    su -
    or
    Code:
    su - root
    Don't leave out the -!!!!!!! Often people do leave that out when they give instructions. Just do it correctly.
    Then,
    Code:
    # cat /var/log/messages
    su short for Super User logs you in as the root user where you can perform administrative tasks.

    LS=List
    This will list the files in the current working directory unless you provide a full path or specific files if you specify them.

    Code:
    $ ls
    Code:
    $ ls /home
    Common options you should be aware of:

    Code:
    $ ls -l
    That lists files in a listing format showing permissions, access and/or modified times of files and other useful information.

    Now what happens if there are too many files to display and the screen is full? I won't get into pipes until later, but this is what you do.

    Code:
    $ ls /etc | less
    In summary, that takes the stdout (Standard Output Stream) and pipes it so that its read from stdin (Standard Input Stream) of the less text viewer (not editor)

    How do you run a file from the command line whether it is a graphical application (GUI) or has a Command Line Interface (CLI)?

    If you type ls and you are able to see the file you wish to run, then you can simply do this.

    ./quake4

    Before I explain why a dot is used, I must tell you other things.

    Now the game can be run from anywhere.

    /home/myuser/Gamez/quake4

    Though some scripts/binaries may not like themselves to be run from another directory. That's why I use a little trick when adding them to my Gnome menu, so that they execute from the directory they are in.

    In the first example, the dot mean current directory. Instead of typing the full path, the dot told bash that the file I want to run is in the current directory. Otherwise the file is not found and the file is looked for in the PATH.

    Your Path are directory locations where a lot of the commands are located. The commands are files that exist in those directories. On many distros, your path will be different when you are logged in as root rather than a non privileged user. Here's how to see what is in your PATH. PATH is a variable to contain the values of your PATH.

    Code:
    echo $PATH
    Now any files in those directories can be called on without just by typing there names. Often directories are have the word bin in them which means binary or sbin which means system binary. Some users create a bin in their home directories, and depending on how your os is configured, it may automatically find that and use it. Otherwise you will have to edit some bash configuration files.

    Another important note: You can't execute a file unless it has executable permissions. These three are most commonly used for permissions. Also U is User, G is Group, and O is Other.

    Used to change permissions.
    CHMOD = Change MODifications.

    Simple and discouraged form:
    Code:
    $ chmod +x file
    That does the same as this. A means All.
    Code:
    $ chmod a+x file
    What you probably should have wanted was this.
    Code:
    chmod u+x file
    More advanced way than the first:
    Code:
    $ chmod u+rwx,g-wr+x,o-wrx file
    What does all of this mean? You may have intuitively figured it out if you are a computer nerd by nature. u+rwx means give the User (owner) of the file read write and executable permissions. g-wr+x means take away permissions of the members of the the Group (Each file has a User, Group, and Others ownerships. That's next.) write and read permissions, but at the same time, give executable permissions to users in that group.

  2. #2

    Default

    Quote Originally Posted by linuxbeast View Post
    I agree with the mods. For all those that can't handle back|track, come back after you've used Linux for a while. Here are some of the most command commands and mistakes and what you can do to help yourself. GOOGLE is #1, but there other resources too. There's also a www.google.com/linux.
    Excellent reading here linuxbeast, thank you for sharing

  3. #3
    Senior Member
    Join Date
    Mar 2008
    Posts
    153

    Default

    Thanks i've already started reading slackware basics.Keep up the good work

  4. #4
    Senior Member
    Join Date
    Feb 2008
    Posts
    681

    Default

    Thanks for the info and your time in sharing. The essentials are easily overlooked by newcomers and more advanced linux users alike.
    People need to get into a habit of thinking *nix as apposed to of windows.

    Some very useful information over here
    [FONT=Courier New][SIZE=2][FONT=Courier New]hehe...
    [/FONT][/SIZE][/FONT]

  5. #5
    Junior Member
    Join Date
    Feb 2008
    Posts
    40

    Default

    Tip: when reading the logs, I prefer to have them output as it happens in the current window:

    tail -f /var/log/messages &

    That tail's the logfile forever as a background process.

  6. #6
    linuxbeast
    Guest

    Default

    I would like to expand this even more each time, not all at once, but I have exceeded the maximum allowed characters and had to shorten it up a bit. Sense people like this, I've kept it going by adding and modfiying it. This is my way of contributing back to the Linux community for all the Free software I was gave and one of my favorite hobbies. Please make comments, questions and if you know how I can exapand it without the character limitation, then let me know. Thanks guys.

  7. #7
    linuxbeast
    Guest

    Default

    I just thought of something. I could copy this over to my own personal forum and expand it without limitations. I am the site admin and founder. There's sections in my forum from hacking, beginners, distros, programming, etc. Let me know if anyone would be interested. Check it out here.

    http://chris1.redirectme.net/phpBB

    Once in a while that forum is offline. Sorry for the inconvience. Just try again later if it is.

  8. #8
    Senior Member
    Join Date
    Mar 2008
    Posts
    153

    Default

    Was excited when i clicked the link but found that its down.

  9. #9
    linuxbeast
    Guest

    Default

    Try again.

  10. #10
    Just burned his ISO lock_n_loll's Avatar
    Join Date
    Jul 2007
    Posts
    21

    Default

    nice nice nice
    Damn Am I Late ?
    Mitsubishi AMITY XP P166 MMX 32M HD 6 GB Linksys WPC11 v4 FreeBSD 7.0 + BT2

Page 1 of 4 123 ... LastLast

Posting Permissions

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