James Japan's Linux Basics for Absolute Beginners
This page is all about the fundamentals, things you should know before trying to do any of the other procedures on this web site. If you take time to read them and learn them, you'll have a much better understanding of what you're doing and less likely to make a mistake. These principles apply to all distributions of Linux unless specified otherwise.
- Basic principles in using the command line
- About file names
- Working with compressed archive files (.tar .gz .bz etc.)
- Basic principles logging into root
Basic principles in using the command line
Though most operations can be done from the graphical user interface (GUI) like Gnome, some things can only be done from the command line. In Gnome, the command line interface is run from Terminal. You can find Terminal under Applications and Accessories in Gnome. I like to add Terminal to the bottom Gnome panel because I use it so frequently. (See how to add quickstart shortcuts.)Here are two examples of commands:
The "[jamesjpn@dhcppc2 ~]$ " Is what my command line from Gnome Terminal looks like. "jamesjpn" just before the @ mark represents my log in user name, and dhcppc0 is the hostname of my machine. Yours will of course be different but it should end in a $ sign. You can either type the code after the $ sign and press the Enter key, or copy and paste the code written after the $ sign and press the Enter key. So when I say "enter the following command" I mean for you to either type it or copy and paste it and then press the Enter key! I will not tell you to "press the Enter key" each time. It should be understood that you press the Enter key. This is, after all, what "enter the command" means: input the command and press the Enter key.
For short commands like the first example, you can of course type them in, but for long commands like the second example, I advise you to use copy and paste! The commands must be entered exactly as they are written. One misspelling or typo will result in an error message. And so if you get the error message:
ddd bash: ddd: command not foundIt could be because you mistyped it. The only other reason for such an error would be that the particular program that relates to the command is not installed on your system. There is no "ddd" command of course. I just used that because I knew it would result in an error message to show you. Using copy and paste should save you from typos and resultant error messages. All the commands on this page should be error free because I used every one of them myself, and then copied and pasted them to this HTML document.
Blocking and copying text in Linux is exactly the same as it is in Windows. You first block (or highlight) the text with your mouse, and then either tap the "Ctrl C" keyboard combination or right click the blocked text and then left click on Copy from the menu. You can use the shortcut key combination "Shift Insert" to paste in Terminal. The "Ctrl V" shortcut keys for paste won't work in Terminal for some reason, but "Shift Insert" will. Or you can right click in Terminal and then left click on paste.
About file namesUnlike Windows file names, Linux file names are case sensitive! This means that if a command should be spelled out all in lower case like
diryou must enter it all in lower case or you will get an error message like the one below:
diR bash: diR: command not foundNotice I capitalized the last letter "R" in the dir command? Linux did not recognize a command named "diR". In Windows I could type the case anyway I want to, either all caps, all small, or even a combination of the two!
dir DIR dIr DIr diRand Windows would run the command and give me a list of the contents of the directory. But in Linux, it must be entered only in lower case or you will get an error message "command not found".
The reason I'm using the dir command is because this is the only command I know of that is common to both Linux and Windows that can be run from the command prompt.Because Linux is case sensitive, it is usually a good idea to have conformity in file names of documents and other data by saving them all in lower case. If you don't, you might wind up confused later to see two files in the same directory spelled in a different case and you won't know which one to use! For example:
MyReport.doc myreport.doc MYREPORT.doccould all exist in the same directory in Linux. In Windows, even by saving the file in a different case you would overwrite the other one with the same spelling if it existed in the same folder.
Working with compressed archive files
Sometimes you may download from the Internet compressed archive files and have to open them up. These are files that have extensions that end in .tar, .bz, gz, tar.bz2, zip, rar, etc. In Windows, the ZIP format. is considered the standard archive file though RAR is getting more and more popular. Mac users have the .sit format. I've only come across them only twice that I can remember. Most Linux distributions have .zip file support already installed and can get .rar file support by installing it. This tutorial will only cover extracting the contents of an archive and creating a new one.
Let's say you download a file that ends in tar.bz2 and the file is relatively small, say less than 1 megabyte. The simplest way to open and extract the files inside is to just double click the archive file. This opens up a program in Gnome known as Fileroller. With it, you can drag and drop the contents of the archive to your desktop! It's easy use Fileroller when the archive is not so large and doesn't have so many files inside it.
In the case of a relatively large archive file like wine-0.9.26.tar.bz2 which is over 10 megabytes, believe it or not, it is easier to use the command line to extract the contents! This particular archive contains about 6000 some tiny files inside, and dragging and dropping using the Gnome Fileroller is a headache! For one thing, you have to wait for a long time holding down the left mouse while Fireroller is doing its thing, and if you don't wait till its done, Fileroller quits without extracting anything at all!
Rather than dragging and dropping the directory compressed inside the archive, you should left click on the Extract icon in Fileroller. The default location where the files will be extracted to is your home directory.
You can also extract the contents of an archive from the command line in Terminal. In some ways this is preferable if you intend to continue to work from the command line afterwards to compile software from the source of the contents that you extracted from the archive. To do that:
- Unless the archive file is already in your Home directory, drag and drop it on to Home to put it there.
- Open Terminal and enter the following command:
tar -xvf name-archive-fileSubstitute the word "name-archive-file" for the full name of the archive file you are wishing to extract.
You may think that it is a hassle to enter the name of a long archive file in the command line. To avoid that, just enter the ls command to see the contents of the directory you are in, and then highlight the name of the file with your mouse, right click it and then left click on copy. Then you can paste the name after typing tar -xvf by using the shortcut keys of Shift Insert.
To create an archive that you wish to send to somebody else is easier because no matter how many files you want to compress, you can do it from the graphical interface.
To make an archive of an entire directory, just right click on the directory, and then left click on Create Archive... If the person you are sending the file to is a Windows user, you should change the default extension in the archive manager window to .zip if it is not set that way already by clicking on the drop down arrow. The default name of the archive will be the same as the directory you are using to make the archive with. Left click on the Create button to make the archive
To create an archive of files you choose, simply hold down the Ctrl key and left click on the files you wish to include in the archive, right click on one of the files, and then left click on Create Archive. The default name of this archive will be the directory you are working from, so it is good to change the name to something appropriate before you click on the Create button. Or you can rename the archive file later by highlighting the archive file and pressing the F2 key. Just be careful to change only the name before the extension and not the extension.
Logging into Root
Some commands entered on the command line from Terminal will work only if you have root access. This is the same meaning as "Administrator" in Windows. In Linux root access is also called being a "super user". The great thing about Linux is that you do not have to log out of your user account to get administrator privileges like you do in Windows. Only Windows Vista coming out in 2007 will give you the option to install software from a user account by prompting you for a password. Linux / Unix / Macs have had this feature from the very beginning.To log into root, simply open Gnome Terminal, enter su, and enter your password.
Comments? Questions? Errors found? Email: